示例#1
0
        protected void create_platforms()
        {
            bool right_battler_is_battler_1 = Reverse;

            Platform = new Battle_Platform(Distance > 1);

            var battler1 = Battler_1;
            var battler2 = Battler_2;

            // Skills: Swoop
            if (battler2 != null && battler1.swoop_activated)
            {
                // Use the opponent's platform for swooping attackers
                battler1 = battler2;
            }

            Game_Unit right_battler = battler1, left_battler = battler1;

            if (battler2 != null)
            {
                right_battler = Reverse ? battler1 : battler2;
                left_battler  = !Reverse ? battler1 : battler2;
            }

            int rightPlatformTerrain = right_battler.terrain_id();

            Platform.platform_2 = platform(rightPlatformTerrain, Distance);
            Platform.loc_2      = (right_battler_is_battler_1 ? Battler_1_Loc : Battler_2_Loc) + new Vector2(Distance == 1 ? -24 : -37, 94);

            int leftPlatformTerrain = left_battler.terrain_id();

            Platform.platform_1 = platform(leftPlatformTerrain, Distance);
            Platform.loc_1      = Platform.loc_2 + new Vector2(Distance == 1 ? -87 : -(154 + (Distance == 2 ? 0 : 270)), 0);
        }
示例#2
0
        protected virtual Texture2D background(Game_Unit battler)
        {
            const string background_format = @"Graphics/Battlebacks/{0}-BG";

            // Checks if the map has a forced background for this tile
            string terrain_name = Global.game_map.forced_battleback(battler.loc);

            if (!string.IsNullOrEmpty(terrain_name))
            {
                if (Global.content_exists(string.Format(background_format, terrain_name)))
                {
                    return(battle_content.Load <Texture2D>(string.Format(background_format, terrain_name)));
                }
            }

            // Else loads based on terrain type
            int       tag = battler.terrain_id();
            Texture2D result;

            // Check for background
            terrain_name = Global.data_terrains[tag].BackgroundName;
            result       = terrain_texture(background_format, terrain_name);
            if (result != null)
            {
                return(result);
            }

            return(battle_content.Load <Texture2D>(string.Format(background_format, "Plains")));
        }
 public void play_death_quote(int unit_id)
 {
     if (!string.IsNullOrEmpty(Global.game_state.get_death_quote(unit_id)))
     {
         Game_Unit dying_unit = Global.game_map.units[unit_id];
         Global.game_temp.message_text = Global.death_quotes[Global.game_state.get_death_quote(unit_id)];
         Global.scene.new_message_window();
         if (!dying_unit.is_opposition)
         {
             Global.scene.message_reverse();
         }
         if (dying_unit.is_player_team || dying_unit.loss_on_death) //Multi
         {
             Global.Audio.BgmFadeOut(15);
             if (dying_unit.loss_on_death)
             {
                 Global.Audio.PlayBgm(Global.BgmConfig.GameOverTheme);
             }
             else
             {
                 Global.Audio.PlayBgm(Global.BgmConfig.AllyDeathTheme);
             }
         }
     }
 }
示例#4
0
        public void UnitMenuUseItem(Game_Unit unit, int itemIndex, Maybe <Vector2> targetLoc, Maybe <int> promotionId)
        {
            Global.game_map.clear_move_range();
            unit.cantoing = false;
            // Lock in unit movement
            unit.moved();

            if (promotionId.IsSomething)
            {
                Global.game_state.call_item(
                    unit.id, itemIndex, promotionId);
            }
            else if (targetLoc.IsSomething)
            {
                Global.game_state.call_item(
                    unit.id, itemIndex, targetLoc);
            }
            else
            {
                Global.game_state.call_item(unit.id, itemIndex);
            }

            Global.game_temp.menuing = false;
            close_unit_menu(false);
        }
示例#5
0
        public override void set_images(Game_Unit unit)
        {
            Game_Actor actor = unit.actor;

            // Stats
            switch (actor.power_type())
            {
            case Power_Types.Strength:
                PowNode.set_label("Str");
                break;

            case Power_Types.Magic:
                PowNode.set_label("Mag");
                break;

            default:
                PowNode.set_label("Pow");
                break;
            }

            SiegeBg.visible = !unit.actor.is_full_items && unit.is_on_siege();

            // Refresh UI nodes
            refresh(unit);
        }
示例#6
0
 protected virtual void exp_gain_test(
     Game_Unit battler_1, Game_Unit battler_2,
     int attacker,
     KeyValuePair <Combat_Round_Data, List <Combat_Action_Data> > data)
 {
     if (attacker == 1)
     {
         Exp_Gain1 = Math.Max(0, Exp_Gain1);
         int uses = battler_1.weapon_use_count(data.Key.Result.hit);
         add_weapon_uses(ref Weapon_1_Uses, uses, this.weapon1);
         Wexp1 += data.Key.Result.wexp;
         if (data.Key.is_successful_hit(this.weapon1))
         {
             Full_Exp1 = true;
         }
     }
     else
     {
         Exp_Gain2 = Math.Max(0, Exp_Gain2);
         int uses = battler_2.weapon_use_count(data.Key.Result.hit);
         add_weapon_uses(ref Weapon_2_Uses, uses, this.weapon2);
         Wexp2 += data.Key.Result.wexp;
         if (data.Key.is_successful_hit(this.weapon2))
         {
             Full_Exp2 = true;
         }
     }
 }
示例#7
0
 private void get_exp_gain(Game_Unit battler, Game_Unit target,
                           int attacker, ref int expGain)
 {
     if (battler_can_gain_exp(battler, target) &&
         battler.actor.can_level() && expGain > -1)
     {
         if (attacker == 1)
         {
             expGain = exp_gain(battler, target, this.weapon1, Kill == 2);
             if (!Full_Exp1)
             {
                 expGain = (int)MathHelper.Clamp(expGain / 2, 1, 5);
             }
         }
         else
         {
             expGain = exp_gain(battler, target, this.weapon1, Kill == 1);
             if (!Full_Exp2)
             {
                 expGain = (int)MathHelper.Clamp(expGain / 2, 1, 5);
             }
         }
     }
     else
     {
         expGain = 0;
     }
 }
示例#8
0
        private void add_attacks(
            Game_Unit battler_1, Combat_Map_Object battler_2,
            int i, Data_Weapon weapon)
        {
#if DEBUG
            System.Diagnostics.Debug.Assert(i == 1 || i == 2);
#endif
            Game_Unit         attacker = i == 2 ? battler_2 as Game_Unit : battler_1;
            Combat_Map_Object target   = i == 2 ? battler_1 : battler_2;

            int num_hits = 1;
            if (!attacker.is_brave_blocked())
            {
                // If only single hits against terrain
                if (!(target != null && !target.is_unit() &&
                      Constants.Combat.BRAVE_BLOCKED_AGAINST_DESTROYABLE))
                {
                    num_hits = weapon.HitsPerAttack;
                }
            }
            for (int j = 0; j < num_hits; j++)
            {
                add_attacks(battler_1, battler_2, i);
            }
        }
示例#9
0
        public void show_attack_range(int id)
        {
            Game_Unit unit = units[id];

            lock (Move_Range_Lock)
            {
                Attack_Range.UnionWith(unit.attack_range);
                //Attack_Range = Attack_Range.Distinct().ToList(); //ListOrEquals //HashSet
                Staff_Range.UnionWith(unit.staff_range);
                //Staff_Range = Staff_Range.Distinct().ToList(); //ListOrEquals //HashSet

                //Attack_Range = Attack_Range.Except(Talk_Range).ToList();
                //Attack_Range = Attack_Range.Except(Move_Range).ToList();
                //Staff_Range = Staff_Range.Except(Talk_Range).ToList();
                //Staff_Range = Staff_Range.Except(Move_Range).ToList();
                //Staff_Range = Staff_Range.Except(Attack_Range).ToList();
                Attack_Range.ExceptWith(Talk_Range); //HashSet
                Attack_Range.ExceptWith(Move_Range);
                Staff_Range.ExceptWith(Talk_Range);
                Staff_Range.ExceptWith(Move_Range);
                Staff_Range.ExceptWith(Attack_Range);

                //@Debug: why
                //Selected_Move_Total = 0;
            }
        }
示例#10
0
        public bool is_blocked(Vector2 loc, int id, bool fow)
        {
            if (is_off_map(loc))
            {
#if DEBUG
                Print.message("immoissubke location[" + loc.X.ToString() + ", " + loc.Y.ToString() + "]");
#endif
                return(true);
            }
            Game_Unit unit = get_unit(loc);
            // Falsely returns that no unit is at this tile if the unit can't see it
            if (unit != null)
            {
                if (fow && !unit.visible_by(this.units[id].team))
                {
                    unit = null;
                }
            }
            // If there is a unit here and it's not the tested one
            if (unit != null && unit.id != id)
            {
                return(true);
            }
            // Block moving onto light runes
            if (get_light_rune(loc) != null)
            {
                return(true);
            }
            return(false);
        }
示例#11
0
 internal void check_update_unit_move_range(Game_Unit unit)
 {
     if (!Updated_Move_Range_Units.Contains(unit.id))
     {
         unit.update_move_range();
     }
 }
示例#12
0
        protected virtual void setup()
        {
            Game_Unit battler_1 = Global.game_map.units[Battler_1_Id];
            Game_Unit battler_2 = Battler_2_Id == null ? null : Global.game_map.units[(int)Battler_2_Id];

            set_variables(battler_1, battler_2);
            List <int> attack_array = new List <int>();

            battler_1.store_state();
            if (battler_2 != null)
            {
                battler_2.store_state();
            }
            process_attacks(battler_1, battler_2);
            // Set battle end stats
            if (Data.Count == 0)
            {
                throw new NotImplementedException("A battle with no attacks tried to occur");
            }
            end_battle();
            set_exp(battler_1, battler_2);
            battler_1.restore_state();
            if (battler_2 != null)
            {
                battler_2.restore_state();
            }
        }
示例#13
0
        public void UnitMenuTalk(Game_Unit unit, int targetId, Canto_Records canto)
        {
            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.activate_talk(unit.id, targetId);
            Global.game_temp.menuing = false;
            close_unit_menu(true);

            unit.cantoing = false;
            // Lock in unit movement
            unit.moved();
            bool cantoMovement = unit.has_canto() && !unit.full_move();

            if (Constants.Gameplay.TALKING_IS_FREE_ACTION)
            {
                Global.game_system.Menu_Canto = canto | Canto_Records.Talk |
                                                (cantoMovement ? Canto_Records.Horse : Canto_Records.None);
                unit.cantoing = true;
            }
            else if (cantoMovement)
            {
                unit.cantoing = true;
            }
            Global.player.facing = 6;
            Global.player.frame  = 1;
        }
示例#14
0
 public void refresh(Game_Unit unit)
 {
     foreach (StatusUINode node in StatusPageNodes)
     {
         node.refresh(unit);
     }
 }
        public virtual void set_images(Game_Unit unit)
        {
            Atk.text = "--";
            Hit.text = "--";
            Crt.text = "--";

            BattlerStats stats  = new BattlerStats(unit.id);
            int          atkSpd = unit.atk_spd();

            if (unit.is_on_siege())
            {
                var siege = unit.items[Siege_Engine.SiegeInventoryIndex];
                if (siege.is_weapon)
                {
                    stats  = new BattlerStats(unit.id, siege.to_weapon);
                    atkSpd = unit.atk_spd(siege.to_weapon.Max_Range, siege.to_weapon);
                }
            }

            AtkSpd.text = atkSpd.ToString();

            if (stats.has_non_staff_weapon)
            {
                Atk.text = stats.dmg().ToString();
                Hit.text = stats.hit().ToString();
                Crt.text = stats.crt().ToString();
            }
        }
示例#16
0
 protected void add_attack(Game_Unit battler_1, Game_Unit battler_2, Scripted_Combat_Stats stats)
 {
     add_data(battler_1, battler_2, stats);
     Data[Data.Count - 1].Key.Attacker = stats.Attacker;
     // Checks if this is the first attack of this unit
     for (int i = 0; i < Data.Count - 1; i++)
     {
         if (Data[i].Key.Attacker == Data[Data.Count - 1].Key.Attacker)
         {
             Data[Data.Count - 1].Key.First_Attack = false;
             break;
         }
     }
     if (stats.Attacker == 1)
     {
         Attacked_1 = true;
     }
     else
     {
         Attacked_2 = true;
     }
     Data[Data.Count - 1].Key.set_attack(Distance, Data[Data.Count - 1].Value, stats);
     // Add Attacks
     battler_1.actor.clear_added_attacks();
     battler_2.actor.clear_added_attacks();
 }
示例#17
0
        public void UnitMenuDiscard(Game_Unit unit, int index)
        {
            TactileLibrary.Item_Data discarded_item =
                unit.actor.whole_inventory[index];
            if (Global.battalion.convoy_ready_for_sending)
            {
                Global.game_battalions.add_item_to_convoy(discarded_item);
                set_item_sent_popup(discarded_item, 240);
            }
            else
            {
                set_item_drop_popup(discarded_item, 240);
            }

            unit.actor.discard_item(index);
            unit.actor.organize_items();

            // If the inventory is still too full after discarding,
            // the discard menu just goes inactive until the map popup closes
            if (unit.actor.too_many_items)
            {
                UnitMenu = UnitMenuManager.ReopenDiscard(this);
            }
            else
            {
                UnitMenu = null;
                if (!Global.game_system.preparations)
                {
                    Global.game_temp.menuing = false;
                }
                Global.game_temp.discard_menuing      = false;
                Global.game_temp.force_send_to_convoy = false;
            }
        }
示例#18
0
        public void set_image(Game_Unit unit, Game_Unit target, int i)
        {
            TactileLibrary.Item_Data item_data = target.actor.items[i];
            if (item_data.non_equipment)
            {
                Icon.texture = null;
                Name.text    = "";
                Uses.text    = "";
                Slash.text   = "";
                Use_Max.text = "";
            }
            else
            {
                bool can_steal = unit.can_steal_item(target, i);
                TactileLibrary.Data_Equipment item = item_data.to_equipment;
                // Icon
                Icon.texture = Global.Content.Load <Texture2D>(@"Graphics/Icons/" + item.Image_Name);
                Icon.index   = item.Image_Index;
                // Name
                Name.text = item.Name;
                // Uses
                Uses.text    = item_data.Uses < 0 ? "--" : item_data.Uses.ToString();
                Slash.text   = "/";
                Use_Max.text = item.Uses < 0 ? "--" : item.Uses.ToString();

                set_text_color(can_steal);
            }
        }
示例#19
0
        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;
            }
        }
示例#20
0
        private bool ValidateMoveArrow()
        {
            Game_Unit selected_unit = get_selected_unit();

            if (Move_Arrow.Any() && selected_unit != null)
            {
                int moveCost = 0;
                for (int i = 1; i < Move_Arrow.Count; i++)
                {
                    Move_Arrow_Data loc = Move_Arrow[i];
                    moveCost += selected_unit.move_cost(new Vector2(loc.X, loc.Y));
                }

                // If the arrow has exceeded the move score
                if (moveCost > selected_unit.canto_mov)
                {
                    Move_Arrow.Clear();
                    Selected_Move_Total = 0;
                    return(false);
                }
                else
                {
                    Selected_Move_Total = moveCost;
                }
            }

            return(true);
        }
示例#21
0
 public void UnitMenuWait(Game_Unit unit)
 {
     unit.start_wait();
     Global.game_temp.menuing = false;
     close_unit_menu(true);
     suspend();
 }
        public void set_images(Game_Unit unit, Game_Actor actor)
        {
            if (unit != null && unit.actor != actor)
            {
                unit = null;
            }

            // Bond
            if (actor.bond > 0)
            {
                Bond_Name.text = Global.game_actors[actor.bond].name; //Yeti
            }
            else
            {
                Bond_Name.text = "-----";
            }
            Bond_Name.offset.X = Font_Data.text_width(Bond_Name.text) / 2;
            // Bonuses
            for (int i = 0; i < 6; i++)
            {
                if (unit != null && unit.actor == actor)
                {
                    Bonuses[i].refresh(unit);
                }
                else
                {
                    Bonuses[i].refresh(actor);
                }
            }
        }
 internal Arena_Combat_Round_Data(Game_Unit battler_1, Game_Unit battler_2, int distance)
     : base(battler_1, battler_2, distance)
 {
     Stats[0] = attack_hit((int)Stats[0], (int)Stats[0], false);
     Stats[1] = attack_dmg((int)Stats[1], (int)Stats[1]);
     Stats[4] = attack_hit((int)Stats[4], (int)Stats[4], false);
     Stats[5] = attack_dmg((int)Stats[5], (int)Stats[5]);
 }
示例#24
0
 protected override int combat_attacks(Game_Unit battler_1, Combat_Map_Object battler_2,
                                       out int numAttacks1, out int numAttacks2)
 {
     // Only one attack per target for area of effect
     numAttacks1 = 1;
     numAttacks2 = 0;
     return(Math.Max(numAttacks1, numAttacks2));
 }
示例#25
0
 protected static bool team_passable(Game_Unit unit, Vector2 loc)
 {
     if (!Unit_Locs.Keys.Contains(loc))
     {
         return(true);
     }
     return(Unit_Locs[loc] != Unit_Passable.Blocked);
 }
示例#26
0
        public void UnitMenuPromotionChoice(Game_Unit unit, int promotionId)
        {
            UnitMenu = null;
            Global.game_temp.menuing = false;

            Global.game_system.Class_Changer   = unit.id;
            Global.game_system.Class_Change_To = promotionId;
        }
示例#27
0
 public Stat_Boost_Popup(int item_id, bool is_item, Game_Unit unit, int time,
                         bool ignoresInput = false)
 {
     initialize(item_id, is_item, unit, false);
     Timer_Max    = time;
     loc          = new Vector2((Config.WINDOW_WIDTH - Width) / 2, 80);
     IgnoresInput = ignoresInput;
 }
        public Terrain_Round_Data(Game_Unit battler_1, Combat_Map_Object battler_2, int distance)
        {
            Battler1      = battler_1;
            TargetTerrain = battler_2;

            List <int?> ary = combat_stats(distance);

            Stats = ary;
        }
示例#29
0
 protected override int exp_gain(Game_Unit battler_1, Game_Unit battler_2, TactileLibrary.Data_Weapon weapon, bool kill)
 {
     //return Math.Max(Exp_Gain1, base.exp_gain(battler_1, battler_2, weapon, kill) / 2);
     return(Math.Min(
                Math.Max(
                    Exp_Gain1,
                    base.exp_gain(battler_1, battler_2, weapon, kill)),
                Constants.Combat.AOE_EXP_GAIN)); //Debug
 }
示例#30
0
        internal Combat_Round_Data(Game_Unit battler_1, Game_Unit battler_2, int distance)
        {
            Battler1 = battler_1;
            Battler2 = battler_2;

            List <int?> ary = combat_stats(distance);

            Stats = ary;
        }