public static void SetDamage(BattleUnit btl, Int32 damage, Byte dmg_mot) { if (btl.IsUnderStatus(BattleStatus.Death)) { btl.Data.fig_info = 32; return; } if (btl.IsUnderStatus(BattleStatus.Petrify)) { btl.Fig = 0; return; } if (btl.Data != FF9StateSystem.Battle.FF9Battle.cur_cmd.regist) { btl.FaceTheEnemy(); } if (!FF9StateSystem.Battle.isDebug) { if (btl.CurrentHp > damage) { if (!btl.IsPlayer || !FF9StateSystem.Settings.IsHpMpFull) { btl.CurrentHp -= (UInt16)damage; } } else { btl.CurrentHp = 0; } } btl.Fig = (Int16)damage; if (dmg_mot != 0) { btl_mot.SetDamageMotion(btl); } else if (btl.CurrentHp == 0) { btl.Kill(); } }
public static UInt16 CheckCoverAbility(UInt16 tar_id) { BattleUnit coverBy = null; BattleUnit targetUnit = btl_scrp.FindBattleUnit(tar_id); if (targetUnit.IsUnderStatus(BattleStatus.Death | BattleStatus.Petrify)) { return(0); } if (targetUnit.HasCategory(CharacterCategory.Female) && targetUnit.CurrentHp < (targetUnit.MaximumHp >> 1)) { coverBy = FindStrongestDefender(SupportAbility2.ProtectGirls, targetUnit); } if (coverBy == null && targetUnit.IsUnderStatus(BattleStatus.LowHP)) { coverBy = FindStrongestDefender(SupportAbility2.Cover, targetUnit); } if (coverBy == null) { return(0); } coverBy.FaceTheEnemy(); coverBy.Data.pos[0] = targetUnit.Data.pos[0]; coverBy.Data.pos[2] = targetUnit.Data.pos[2]; targetUnit.Data.pos[2] -= 400f; btl_mot.setMotion(coverBy.Data, 15); coverBy.IsCovered = true; return(coverBy.Id); }