From: SourceForge.net <no...@so...> - 2007-06-07 03:39:52
|
Bugs item #1730192, was opened at 2007-06-03 11:15 Message generated for change (Comment added) made by seather You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101111&aid=1730192&group_id=1111 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Hendrik (nhnb) Assigned to: Nobody/Anonymous (nobody) Summary: Lifestealing logged twice Initial Comment: [12:58] solidchen tells hendrikTester: I might have found a minor (cosmetical) bug... [12:58] solidchen tells hendrikTester: with a lifestealing weapon the amount of life stolen appears twice in the log and twice above your head I did not verify it ---------------------------------------------------------------------- >Comment By: Seather (seather) Date: 2007-06-07 03:39 Message: Logged In: YES user_id=1152155 Originator: NO now all heals are displayed twice 22:14 < CIA-14> arianne_rpg: chad3f * stendhal/src/games/stendhal/server/ (17 files in 12 dirs): 22:14 < CIA-14> arianne_rpg: Unified setHP() related calls to use heal()/damage()/initHP() methods 22:14 < CIA-14> arianne_rpg: instead (where appropriete). ---------------------------------------------------------------------- Comment By: Seather (seather) Date: 2007-06-06 23:22 Message: Logged In: YES user_id=1152155 Originator: NO I've seen this happening for a long time See 2 blocks of code that do the same thing pasted below, in theory the second should always be called if the first is. When i commented out the first the problem was fixed. RPEntity class (client) onChangedAdded method /* * Healed */ if (changes.has("heal")) { onHealed(changes.getInt("heal")); } /* * HP change */ if (changes.has("hp") && object.has("hp")) { int healing = changes.getInt("hp") - object.getInt("hp"); if (healing > 0) { onHealed(healing); } } Though another question arises: why is life steal changing the "heal" attribute when potions and npc heal don't(or should i say: why is there a heal attribute at all?). Notice below how heal(int) changes the heal attribute while also calling sethp(int) which changes the hp attribute. RPEntity class (server) public void heal(int amount) { if(getHP() != getBaseHP()) { int newHP = getHP() + amount; if (newHP <= getBaseHP()) { setHP(newHP); put("heal", amount); } else { setHP(getBaseHP()); put("heal", getBaseHP() - getHP()); } } } public void setHP(int hp) { this.hp = hp; put("hp", hp); if (base_hp != 0) { put("hp/base_hp", (double) hp / (double) base_hp); } else { put("hp/base_hp", 1); } } note: i have not fixed this ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=101111&aid=1730192&group_id=1111 |