Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private int dmg_target(Game_Unit target)
- {
- Data_Weapon weapon = this.attacker_weapon;
- // Checks if weapon is magic
- bool magic_attack = attacker.check_magic_attack(weapon, Distance);
- bool imbue = (magic_attack && attacker.actor.power_type() == Power_Types.Strength);
- bool is_staff = weapon.is_staff();
- Game_Actor actor2 = target.actor;
- Data_Weapon weapon2 = actor2.weapon;
- int total_damage, target_def;
- int actor_dmg, weapon_dmg, skill_dmg, support_dmg;
- WeaponTriangle tri = Combat.weapon_triangle(attacker, target, weapon, weapon2, Distance); // moved to up here
- // Staff
- if (is_staff)
- {
- actor_dmg = attacker.atk_pow(weapon, magic_attack);
- weapon_dmg = weapon.Mgt;
- skill_dmg = 0;
- attacker.dmg_staff_skill(
- ref skill_dmg, ref weapon_dmg, ref actor_dmg,
- target, magic_attack, Distance);
- support_dmg = support_bonus(Combat_Stat_Labels.Dmg);
- target_def = 0;
- tri = WeaponTriangle.Nothing; // it's a staff, weapon triangle has to be nothing
- }
- // Weapon
- else
- {
- var target_stats = this.target_stats();
- target_def = magic_attack ?
- target_stats.res() : target_stats.def();
- target_def = (weapon.Ignores_Def() ? target_def / 2 : target_def);
- if (weapon.Halves_HP())
- {
- int total_weapon_damage = target_def + (int)Math.Ceiling(target.actor.hp / 2.0f);
- actor_dmg = (int)Math.Ceiling(total_weapon_damage / 2.0f);
- weapon_dmg = (int)Math.Floor(total_weapon_damage / 2.0f);
- }
- else
- {
- actor_dmg = weapon.Ignores_Pow() ?
- 0 : ((int)(attacker.atk_pow(weapon, magic_attack) *
- (imbue ? Constants.Combat.MAGIC_WEAPON_STR_RATE : 1)));
- weapon_dmg = (int)(weapon.Mgt * (imbue ? Constants.Combat.MAGIC_WEAPON_MGT_RATE : 1));
- if (weapon.Ignores_Def())
- weapon_dmg += target_def;
- }
- // Weapon triangle is handled here instead
- skill_dmg = 0;
- if (tri != WeaponTriangle.Nothing)
- skill_dmg += Weapon_Triangle.DMG_BONUS * (tri == WeaponTriangle.Advantage ? 1 : -1) *
- Combat.weapon_triangle_mult(attacker, target, weapon, weapon2, Distance);
- int effectiveness = weapon.effective_multiplier(attacker, target);
- skill_dmg += (weapon_dmg + skill_dmg) * (effectiveness - 1);
- support_dmg = support_bonus(Combat_Stat_Labels.Dmg);
- attacker.dmg_skill(
- ref skill_dmg, ref weapon_dmg, ref actor_dmg, ref support_dmg,
- ref target_def, weapon, target, weapon2, magic_attack,
- Distance);
- }
- total_damage = actor_dmg + weapon_dmg + skill_dmg + support_dmg - target_def;
- int result = attacker.dmg_target_skill(target, weapon, Distance, Math.Max(0, total_damage), tri);
- return result;
- }
Add Comment
Please, Sign In to add comment