1. 物品金币回收有问题

2. 正常的BOSS血量百分比显示:Infinity%
3. 增加伤害的道具 只读取一组 有多组的话不读取
This commit is contained in:
雪风 2025-03-06 15:27:44 +08:00
parent 04692d4e40
commit 5da42e874c
3 changed files with 27 additions and 6 deletions

View File

@ -5686,10 +5686,10 @@ public class MapleCharacter extends AbstractAnimatedMapleMapObject implements Se
if (type == MapleInventoryType.EQUIP) {
return this.inventory[MapleInventoryType.EQUIPPED.ordinal()].countById(itemid);
}
final IItem findById = this.inventory[type.ordinal()].findById(itemid);
short quantity = findById.getQuantity();
int byIdNum = this.inventory[type.ordinal()].findByIdNum(itemid);
return quantity;
return byIdNum;
}

View File

@ -54,6 +54,16 @@ public class MapleInventory implements Iterable<IItem>, Serializable {
return null;
}
public int findByIdNum(final int itemId) {
int re = 0;
for (final IItem item : this.inventory.values()) {
if (item.getItemId() == itemId) {
re+=item.getQuantity();
}
}
return re;
}
public IItem findByUniqueId(final int itemId) {
for (final IItem item : this.inventory.values()) {
if (item.getUniqueId() == itemId) {

View File

@ -441,7 +441,7 @@ public class DamageParse {
long mobMaxHp = monster.getMaxHP();
if (mobMaxHp == 0){
monster.getMobMaxHp();
mobMaxHp = monster.getMobMaxHp();
}
double percentage = ((double) hp / mobMaxHp) * 100; // 显式转换为浮点数并计算百分比‌:ml-citation{ref="1,3" data="citationList"}
@ -1003,9 +1003,20 @@ public class DamageParse {
monster.damage(player, newtotDamageToOneMonster, true, attack.skill);
if (monster.getHp() > 0) {
player.dropMessage(-1, "当前怪物血量为: " + monster.getHp());
}
long hp = monster.getHp();
long mobMaxHp = monster.getMaxHP();
if (mobMaxHp == 0) {
mobMaxHp = monster.getMobMaxHp();
}
double percentage = ((double) hp / mobMaxHp) * 100; // 显式转换为浮点数并计算百分比‌:ml-citation{ref="1,3" data="citationList"}
String result = String.format("%.2f%%", percentage);
double l = (double) hp / mobMaxHp;
player.dropMessage(-1, "当前怪物血量为:" + hp + " " + result);
}
if (monster.isBuffed(MonsterStatus.MAGIC_DAMAGE_REFLECT)) {
player.addHP(-(7000 + Randomizer.nextInt(8000)));