/// <summary> /// Condition for troop are met /// </summary> /// <param Name="page_index">troop event's page index</param> /// <param Name="condition">analysed condition</param> /// <returns>true if conditions are met</returns> public bool IsTroopConditionsMet(int page_index, Troop.Page.Condition condition) { // Return False if no conditions appointed if (!(condition.TurnValid || condition.NpcValid || condition.ActorValid || condition.SwitchValid)) { return(false); } // Return False if page already completed if ((bool)InGame.Temp.BattleEventFlags[page_index]) { return(false); } // Confirm turn conditions if (condition.TurnValid) { int n = InGame.Temp.BattleTurn; int a = condition.TurnA; int b = condition.TurnB; if ((b == 0 && n != a) || (b > 0 && (n < 1 || n < a || n % b != a % b))) { return(false); } } // Confirm enemy conditions if (condition.NpcValid) { GameNpc enemy = InGame.Troops.Npcs[condition.NpcIndex]; if (enemy == null || enemy.Hp * 100.0 / enemy.MaxHp > condition.NpcHp) { return(false); } } // Confirm actor conditions if (condition.ActorValid) { GameActor actor = InGame.Actors[condition.ActorId - 1]; if (actor == null || actor.Hp * 100.0 / actor.MaxHp > condition.ActorHp) { return(false); } } // Confirm switch conditions if (condition.SwitchValid) { if (InGame.Switches.Arr[condition.SwitchId]) { return(true); } else { return(false); } } // Return True return(true); }
///<summary>Adds an actor to the party</summary> ///<param Name="actor_id">actor id in database</param> public void AddActor(int actor_id) { GameActor _actor = InGame.Actors[actor_id]; //Add the actor if it isn't in the party, if (Actors.Count < 4 && !Actors.Contains(_actor)) //TEST : utilisation de contains, l'objet est-il le bon ? { Actors.Add(_actor); InGame.Player.Refresh(); } }
/// <summary> /// Refresh /// </summary> public override void Refresh() { if (InGame.Party.Actors.Count == 0) { // Clear Character file Name and hue CharacterName = ""; CharacterHue = 0; return; } // Get lead actor GameActor actor = InGame.Party.Actors[0]; // Set Character file Name and hue CharacterName = actor.CharacterName; CharacterHue = actor.CharacterHue; // Initialize opacity level and blending method Opacity = 255; BlendType = 0; }
///<summary>Select a specific actor from the party if it is valid, if not a random actor</summary> ///<param Name="actor_index">actor index</param> ///<returns>Target actor</returns> public GameActor SmoothTargetActor(int actor_index) { //Actor selection GameActor _actor = Actors[actor_index]; //If this actor is a valid target, returns it if (_actor != null && _actor.IsExist) { return(_actor); } //If not, take any valid target _actor = null; //_actor is nullified, to return null if there is no valid target //Note : normally, if there is no valid target, there is no more fight. TODO : ckeck it. for (int i = 0; i < Actors.Count; i++) { if (Actors[i].IsExist) { _actor = Actors[i]; } } return(_actor); }