root/trunk/AE-go_GameServer/src/com/aionemu/gameserver/utils/stats/StatFunctions.java
| 2297 | 2440 | ||
|---|---|---|---|
16 | */ | 16 | */ |
17 | package com.aionemu.gameserver.utils.stats; | 17 | package com.aionemu.gameserver.utils.stats; |
18 | 18 | ||
19 | import java.util.TreeSet; | ||
20 | |||
19 | import org.apache.log4j.Logger; | 21 | import org.apache.log4j.Logger; |
20 | 22 | ||
21 | import com.aionemu.commons.utils.Rnd; | 23 | import com.aionemu.commons.utils.Rnd; |
... | ... | ||
31 | import com.aionemu.gameserver.model.gameobjects.state.CreatureState; | 33 | import com.aionemu.gameserver.model.gameobjects.state.CreatureState; |
32 | import com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats; | 34 | import com.aionemu.gameserver.model.gameobjects.stats.CreatureGameStats; |
33 | import com.aionemu.gameserver.model.gameobjects.stats.StatEnum; | 35 | import com.aionemu.gameserver.model.gameobjects.stats.StatEnum; |
36 | import com.aionemu.gameserver.model.gameobjects.stats.modifiers.SimpleModifier; | ||
37 | import com.aionemu.gameserver.model.gameobjects.stats.modifiers.StatModifier; | ||
34 | import com.aionemu.gameserver.model.templates.item.WeaponType; | 38 | import com.aionemu.gameserver.model.templates.item.WeaponType; |
35 | import com.aionemu.gameserver.model.templates.stats.NpcRank; | 39 | import com.aionemu.gameserver.model.templates.stats.NpcRank; |
36 | import com.aionemu.gameserver.network.aion.serverpackets.SM_ATTACK_STATUS; | 40 | import com.aionemu.gameserver.network.aion.serverpackets.SM_ATTACK_STATUS; |
41 | import com.aionemu.gameserver.services.ItemService; | ||
37 | import com.aionemu.gameserver.utils.PacketSendUtility; | 42 | import com.aionemu.gameserver.utils.PacketSendUtility; |
38 | 43 | ||
39 | /** | 44 | /** |
... | ... | ||
303 | //TODO move to controller | 308 | //TODO move to controller |
304 | if(weaponType == WeaponType.BOW) | 309 | if(weaponType == WeaponType.BOW) |
305 | equipment.useArrow(); | 310 | equipment.useArrow(); |
311 | |||
312 | if(equipment.getMainHandWeapon().hasFusionedItem()) | ||
313 | { | ||
314 | Item fusionedItem = ItemService.newItem(equipment.getMainHandWeapon().getFusionedItem(), 1); | ||
315 | if(fusionedItem != null) | ||
316 | { | ||
317 | TreeSet<StatModifier> fusionedModifiers = fusionedItem.getItemTemplate().getModifiers(); | ||
318 | for(StatModifier sm : fusionedModifiers) | ||
319 | { | ||
320 | if(sm.getStat() == StatEnum.MAIN_HAND_POWER && sm instanceof SimpleModifier) | ||
321 | { | ||
322 | SimpleModifier mod = (SimpleModifier)sm; | ||
323 | mainHandAttack += Math.round(mod.getValue() / 10); | ||
324 | } | ||
325 | } | ||
326 | } | ||
327 | } | ||
306 | 328 | ||
307 | int min = Math.round((((mainHandAttack * 100)/ average) * totalMin)/100); | 329 | int min = Math.round((((mainHandAttack * 100)/ average) * totalMin)/100); |
308 | int max = Math.round((((mainHandAttack * 100)/ average) * totalMax)/100); | 330 | int max = Math.round((((mainHandAttack * 100)/ average) * totalMax)/100); |
309 | 331 | ||
310 | int base = Rnd.get(min,max); | 332 | int base = Rnd.get(min,max); |
311 | 333 | ||
334 | |||
335 | |||
312 | resultDamage = Math.round((base * (ags.getCurrentStat(StatEnum.POWER) * 0.01f + (ags.getBaseStat(StatEnum.MAIN_HAND_POWER) * 0.2f)* 0.01f)) | 336 | resultDamage = Math.round((base * (ags.getCurrentStat(StatEnum.POWER) * 0.01f + (ags.getBaseStat(StatEnum.MAIN_HAND_POWER) * 0.2f)* 0.01f)) |
313 | + ags.getStatBonus(StatEnum.MAIN_HAND_POWER) + skillDamages); | 337 | + ags.getStatBonus(StatEnum.MAIN_HAND_POWER) + skillDamages); |
314 | 338 | ||
... | ... | ||
435 | { | 459 | { |
436 | CreatureGameStats<?> sgs = speller.getGameStats(); | 460 | CreatureGameStats<?> sgs = speller.getGameStats(); |
437 | CreatureGameStats<?> tgs = target.getGameStats(); | 461 | CreatureGameStats<?> tgs = target.getGameStats(); |
462 | |||
463 | int totalBoostMagicalSkill = 0; | ||
464 | |||
465 | if(speller instanceof Player && ((Player)speller).getEquipment().getMainHandWeapon() != null && ((Player)speller).getEquipment().getMainHandWeapon().hasFusionedItem()) | ||
466 | { | ||
467 | Item fusionedItem = ItemService.newItem(((Player)speller).getEquipment().getMainHandWeapon().getFusionedItem(), 1); | ||
468 | if(fusionedItem != null) | ||
469 | { | ||
470 | TreeSet<StatModifier> fusionedModifiers = fusionedItem.getItemTemplate().getModifiers(); | ||
471 | for(StatModifier sm : fusionedModifiers) | ||
472 | { | ||
473 | if(sm.getStat() == StatEnum.BOOST_MAGICAL_SKILL && sm instanceof SimpleModifier) | ||
474 | { | ||
475 | SimpleModifier mod = (SimpleModifier)sm; | ||
476 | totalBoostMagicalSkill += Math.round(mod.getValue() / 10); | ||
477 | } | ||
478 | } | ||
479 | } | ||
480 | } | ||
438 | 481 | ||
439 | int damages = Math.round(baseDamages * ((sgs.getCurrentStat(StatEnum.KNOWLEDGE) / 100f) + (sgs.getCurrentStat(StatEnum.BOOST_MAGICAL_SKILL) / 1000f))); | 482 | totalBoostMagicalSkill += sgs.getCurrentStat(StatEnum.BOOST_MAGICAL_SKILL); |
440 | 483 | ||
484 | int damages = Math.round(baseDamages * ((sgs.getCurrentStat(StatEnum.KNOWLEDGE) / 100f) + (totalBoostMagicalSkill / 1000f))); | ||
485 | |||
441 | //adjusting baseDamages according to attacker and target level | 486 | //adjusting baseDamages according to attacker and target level |
442 | // | 487 | // |
443 | damages = adjustDamages(speller, target, damages); | 488 | damages = adjustDamages(speller, target, damages); |
Download diff