public void UnitMenuStaff(Game_Unit unit, int targetId, Vector2 targetLoc) { Global.game_map.clear_move_range(); // Lock in unit movement unit.moved(); Global.game_state.call_staff( unit.id, targetId, targetLoc); Global.game_state.call_battle(unit.id, targetId); if (unit.actor.weapon.Hits_All_in_Range()) { foreach (int id in Global.game_system.Aoe_Targets) { if (Global.game_map.units.ContainsKey(id)) { // Adds to list of attacked units for this turn if (unit.is_attackable_team(Global.game_map.units[id])) { unit.add_attack_target(id); unit.same_target_support_gain_display(id); } else { unit.heal_support_gain_display(id); } } } } else { if (Global.game_map.units.ContainsKey(targetId)) { // Adds to list of attacked units for this turn if (unit.is_attackable_team(Global.game_map.units[targetId])) { unit.add_attack_target(targetId); unit.same_target_support_gain_display(targetId); } else { unit.heal_support_gain_display(targetId); } } } Global.game_temp.clear_temp_range(); Global.game_temp.menuing = false; close_unit_menu(true); }
public void UnitMenuSteal(Game_Unit unit, int targetId, int itemIndex) { Global.game_map.remove_updated_move_range(unit.id); Global.game_map.clear_move_range(); Global.game_map.range_start_timer = 0; Global.game_state.call_steal(unit.id, targetId, itemIndex); // Adds to list of attacked units for this turn if (Global.game_map.units.ContainsKey(Global.game_system.Battler_2_Id) && unit.is_attackable_team(Global.game_map.units[Global.game_system.Battler_2_Id])) { unit.add_attack_target(Global.game_system.Battler_2_Id); unit.same_target_support_gain_display(Global.game_system.Battler_2_Id); } Global.game_temp.menuing = false; close_unit_menu(true); unit.cantoing = false; // Lock in unit movement unit.moved(); if (unit.has_canto() && !unit.full_move()) { unit.cantoing = true; } }
public void UnitMenuAttack(Game_Unit unit, int targetId) { Global.game_map.clear_move_range(); // Lock in unit movement unit.moved(); // Skills: Trample if (unit.trample_activated) { unit.set_trample_loc(); } // Skills: Old Swoop //@Debug if (unit.old_swoop_activated) { Global.game_state.call_battle(unit.id, unit.enemies_in_old_swoop_range(unit.facing)[0]); sort_aoe_targets(unit.id); // Adds to list of attacked units for this turn foreach (int id in Global.game_system.Aoe_Targets) { if (Global.game_map.units.ContainsKey(id) && unit.is_attackable_team(Global.game_map.units[id])) { unit.add_attack_target(id); } } unit.same_target_support_gain_display(Global.game_system.Aoe_Targets); } else { Global.game_state.call_battle(unit.id, targetId); // Adds to list of attacked units for this turn if (Global.game_map.units.ContainsKey(targetId) && unit.is_attackable_team(Global.game_map.units[targetId])) { unit.add_attack_target(targetId); unit.same_target_support_gain_display(targetId); } } Global.game_temp.clear_temp_range(); Global.game_temp.menuing = false; close_unit_menu(true); }
protected virtual bool battler_can_gain_exp(Game_Unit battler, Game_Unit target = null) { if (!battler.allowed_to_gain_exp()) { return(false); } // If the target exists, either the target needs to be on the opposing team or the attacker needs to not be berserk return(target == null || !battler.berserk || battler.is_attackable_team(target)); }
protected virtual bool attackable(Game_Unit attacker, Combat_Map_Object target) { // If target doesn't exist because it's a flare use/etc if (target == null) { return(true); } // If attacker is dead return //@Debug: make sure units who are out of hp but technically aren't // dead for whatever reason will stop if (attacker.hp <= 0) //@Debug: .is_dead) { return(false); } bool is_target_unit = false; // If the target is already dead, stop attacking if (target.hp <= 0) { // Don't return if either battler wants the attacks to continue if (!attacker.continue_attacking() && !(target.is_unit() && (target as Game_Unit).continue_attacking())) { return(false); } } Game_Unit target_unit = null; if (target.is_unit()) { is_target_unit = true; target_unit = (Game_Unit)target; } var weapon = attacker.id == Battler_1_Id ? this.weapon1 : this.weapon2; if (weapon == null) { return(false); } // If target is berserk ally and attacker isn't berserk, don't hurt your friend >: if (is_target_unit && attacker.id != Battler_1_Id && !attacker.is_attackable_team(target_unit) && !can_counter_ally(attacker)) { return(false); } int hit, uses; if (attacker.id == Battler_1_Id) { List <int?> ary = Combat.combat_stats(attacker.id, target.id, Distance); hit = 100; uses = Weapon_1_Uses; if (ary[0] == null && !weapon.is_staff()) { return(false); // This is newly added to account for the attacker being put to sleep, did any other cases make hit null? } if (ary[0] != null) { hit = (int)ary[0]; } } else { List <int?> ary = Combat.combat_stats(target.id, attacker.id, Distance); if (ary[4] == null) { return(false); } hit = (int)ary[4]; uses = Weapon_2_Uses; } // Breaks if the attacker can't fight/broke their weapon if (hit < 0 || attacker.is_weapon_broke(uses)) { return(false); } return(true); }
public bool check_talk(Game_Unit battler_1, Game_Unit battler_2, bool reverse, bool test) { if (battler_2 == null) { return(false); } // Specific for two people for (int i = 0; i < Global.game_state.battle_convos.Count; i++) { Battle_Convo convo = Global.game_state.battle_convos[i]; if ((convo.Id1 == battler_1.id && convo.Id2 == battler_2.id) || (convo.Id1 == battler_2.id && convo.Id2 == battler_1.id)) { if (convo.Activated) { return(false); } if (!string.IsNullOrEmpty(convo.Value)) { if (!Global.battle_text.ContainsKey(convo.Value)) { #if DEBUG Print.message(string.Format( "Boss quote \"{0}\" does not exist", convo.Value)); #endif return(false); } if (test) { return(true); } new_message_window(); if (convo.Id1 == battler_1.id ^ !reverse) { message_reverse(); } Global.game_temp.message_text = Global.battle_text[convo.Value]; Global.game_state.clear_battle_convo(i); } return(false); } } // Specific for one person for (int i = 0; i < Global.game_state.battle_convos.Count; i++) { Battle_Convo convo = Global.game_state.battle_convos[i]; if (!convo.Activated && ((convo.Id1 == battler_1.id || convo.Id1 == battler_2.id) && convo.Id2 == -1 && battler_1.is_attackable_team(battler_2))) { if (!string.IsNullOrEmpty(convo.Value)) { if (!Global.battle_text.ContainsKey(convo.Value)) { #if DEBUG Print.message(string.Format( "Boss quote \"{0}\" does not exist", convo.Value)); #endif return(false); } if (test) { return(true); } Global.game_temp.message_text = Global.battle_text[convo.Value]; //Debug Global.game_state.clear_battle_convo(i); new_message_window(); if (convo.Id1 == battler_1.id ^ !reverse) { message_reverse(); } //Global.game_temp.message_text = Global.battle_text[convo.Value]; //Debug //Global.game_map.clear_battle_convo(i); } return(false); } } return(false); }