Example #1
0
        ///<summary>Random Target (for Enemy)</summary>
        public void DecideRandomTargetforEnemy()
        {
            // Diverge with Effect scope
            GameBattler _battler = null;

            if (IsForOneFriendHp0())
            {
                _battler = InGame.Troops.RandomTargetNpcHp0();
            }
            else if (IsForOneFriend())
            {
                _battler = InGame.Troops.RandomTargetNpc();
            }
            else
            {
                _battler = InGame.Party.RandomTargetActor();
            }
            // If a target exists, get an index, and if a target doesn't exist,
            // Clear the action
            if (_battler != null)
            {
                TargetIndex = _battler.Index;
            }
            else
            {
                Clear();
            }
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param Name="viewport">viewport</param>
 /// <param Name="Battler">associated GameBattler</param>
 public SpriteBattler(Viewport viewport, GameBattler battler)
     : base(viewport)
 {
     this.battler     = battler;
     isBattlerVisible = false;
     Z = 101;
 }
Example #3
0
        /// <summary>
        /// Make State Text String for Drawing
        /// </summary>
        /// <param Name="Battler">actor</param>
        /// <param Name="width">draw spot width</param>
        /// <param Name="need_normal">Whether or not [normal] is needed (true / false)</param>
        /// <returns></returns>
        public string MakeBattlerStateText(GameBattler battler, int width, bool need_normal)
        {
            // Get width of brackets
            int _brackets_width = this.Contents.TextSize("[]").Width;
            // Make text string for state names
            string _text = "";

            foreach (int i in battler.states)
            {
                if (Data.States[i].Rating >= 1)
                {
                    if (_text == "")
                    {
                        _text = Data.States[i].Name;
                    }
                    else
                    {
                        string new_text   = _text + "/" + Data.States[i].Name;
                        int    text_width = this.Contents.TextSize(new_text).Width;
                        if (text_width > width - _brackets_width)
                        {
                            break;
                        }
                        _text = new_text;
                    }
                }
            }
            // If text string for state names is empty, make it [normal]
            if (_text == "")
            {
                if (need_normal)
                {
                    _text = "[Normal]";
                }
            }
            else
            {
                // Attach brackets
                _text = "[" + _text + "]";
            }
            // Return completed text string
            return(_text);
        }
Example #4
0
        /// <summary>
        /// Last Target (for Enemy)
        /// </summary>
        public void DecideLastTargetForEnemy()
        {
            GameBattler _battler = null;

            // If Effect scope is ally, then it's an actor, anything else is an enemy
            if (TargetIndex == -1)
            {
                _battler = null;
            }
            else if (IsForOneFriend())
            {
                _battler = InGame.Troops.Npcs[TargetIndex];
            }
            else
            {
                _battler = InGame.Party.Actors[TargetIndex];
            }
            // Clear action if no target exists
            if (_battler == null || !_battler.IsExist)
            {
                Clear();
            }
        }
Example #5
0
 /// <summary>
 /// Go to Command Input of Previous Actor
 /// </summary>
 void Phase3PriorActor()
 {
     // Loop
     do
     {
         // Actor blink Effect OFF
         if (activeBattler != null)
         {
             activeBattler.IsBlink = false;
         }
         // If first actor
         if (actorIndex == 0)
         {
             // Start party command phase
             StartPhase2();
             return;
         }
         // Return to actor index
         actorIndex -= 1;
         activeBattler = InGame.Party.Actors[actorIndex];
         activeBattler.IsBlink = true;
         // Once more if actor refuses command input
     } while (!activeBattler.IsInputable);
     // Set up actor command window
     Phase3SetupCommandwindow();
 }
Example #6
0
 /// <summary>
 /// Go to Command Input for Next Actor
 /// </summary>
 void Phase3NextActor()
 {
     // Loop
     do
     {
         // Actor blink Effect OFF
         if (activeBattler != null)
         {
             activeBattler.IsBlink = false;
         }
         // If last actor
         if (actorIndex == InGame.Party.Actors.Count - 1)
         {
             // Start main phase
             StartPhase4();
             return;
         }
         // Advance actor index
         actorIndex += 1;
         activeBattler = InGame.Party.Actors[actorIndex];
         activeBattler.IsBlink = true;
         // Once more if actor refuses command input
     } while (!activeBattler.IsInputable);
     // Set up actor command window
     Phase3SetupCommandwindow();
 }
Example #7
0
 /// <summary>
 /// Start Actor Command Phase
 /// </summary>
 void StartPhase3()
 {
     // Shift to phase 3
     phase = 3;
     // Set actor as unselectable
     actorIndex = -1;
     activeBattler = null;
     // Go to command input for next actor
     Phase3NextActor();
 }
Example #8
0
 /// <summary>
 /// Start Party Command Phase
 /// </summary>
 void StartPhase2()
 {
     // Shift to phase 2
     phase = 2;
     // Set actor to non-selecting
     actorIndex = -1;
     activeBattler = null;
     // Enable party command window
     partyCommandWindow.IsActive = true;
     partyCommandWindow.IsVisible = true;
     // Disable actor command window
     actorCommandWindow.IsActive = false;
     actorCommandWindow.IsVisible = false;
     // Clear main phase flag
     InGame.Temp.BattleMainPhase = false;
     // Clear all party member actions
     InGame.Party.ClearActions();
     // If impossible to input command
     if (!InGame.Party.IsInputable)
     {
         // Start main phase
         StartPhase4();
     }
 }
Example #9
0
 /// <summary>
 /// Frame Update (main phase step 1 : action preparation)
 /// </summary>
 void UpdatePhase4Step1()
 {
     // Hide help window
     helpWindow.IsVisible = false;
     // Determine win/loss
     if (IsJudged())
     {
         // If won, or if lost : end method
         return;
     }
     // If an action forcing Battler doesn't exist
     if (InGame.Temp.ForcingBattler == null)
     {
         // Set up battle event
         SetupBattleEvent();
         // If battle event is running
         if (InGame.Temp.BattleInterpreter.IsRunning)
         {
             return;
         }
     }
     // If an action forcing Battler exists
     if (InGame.Temp.ForcingBattler != null)
     {
         // Add to head, or move
         actionBattlers.Remove(InGame.Temp.ForcingBattler);
         actionBattlers.Insert(0, InGame.Temp.ForcingBattler);
     }
     // If no actionless battlers exist (all have performed an action)
     if (actionBattlers.Count == 0)
     {
         // Start party command phase
         StartPhase2();
         return;
     }
     // Initialize Animation ID and common event ID
     animation1Id = 0;
     animation2Id = 0;
     commonEventId = 0;
     // Shift from head of actionless battlers
     activeBattler = actionBattlers[0];
     actionBattlers.RemoveAt(0);
     // If already removed from battle
     /*
     if (active_battler.index == null)
     {
         return;
     }*/
     // Slip damage
     if (activeBattler.Hp > 0 && activeBattler.IsSlipDamage)
     {
         activeBattler.SlipDamageEffect();
         activeBattler.IsDamagePop = true;
     }
     // Natural removal of states
     activeBattler.RemoveStatesAuto();
     // Refresh status window
     statusWindow.Refresh();
     // Shift to step 2
     phase4Step = 2;
 }
Example #10
0
 /// <summary>
 /// Start Main Phase
 /// </summary>
 void StartPhase4()
 {
     // Shift to phase 4
     phase = 4;
     // Turn count
     InGame.Temp.BattleTurn += 1;
     // Search all battle event pages
     for (int index = 0; index < Data.Troops[troopId].Pages.Length; index++)
     {
         // Get event page
         Troop.Page _page = Data.Troops[troopId].Pages[index];
         // If this page span is [turn]
         if (_page.Span == 1)
         {
             // Clear action completed flags
             InGame.Temp.BattleEventFlags[index] = false;
         }
     }
     // Set actor as unselectable
     actorIndex = -1;
     activeBattler = null;
     // Enable party command window
     partyCommandWindow.IsActive = false;
     partyCommandWindow.IsVisible = false;
     // Disable actor command window
     actorCommandWindow.IsActive = false;
     actorCommandWindow.IsVisible = false;
     // Set main phase flag
     InGame.Temp.BattleMainPhase = true;
     // Make enemy action
     foreach (GameNpc npc in InGame.Troops.Npcs)
     {
         npc.MakeAction();
     }
     // Make action orders
     MakeActionOrders();
     // Shift to step 1
     phase4Step = 1;
 }
 /// <summary>
 /// Constructor (Battler = null)
 /// </summary>
 /// <param Name="viewport">viewport on which sprite is displayed</param>
 public SpriteBattler(Viewport viewport)
     : base(viewport)
 {
     this.battler     = null;
     isBattlerVisible = false;
 }