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