Exemple #1
0
        protected BattleIcon(StateOfBattle battle, Combatant receiver)
        {
            X = receiver.X;
            Y = receiver.Y;

            Color = Colors.WHITE;
            AnimationTimer = new Timer(ANIMATION_DURATION);
        }
        public AbilityFailEvent(Combatant source, Ability ability, bool resetSourceTurnTimer)
            : base(source, resetSourceTurnTimer)
        {
            Ability = ability.Name;

            if (source is Ally)
            {
                Status = "Not enough MP for " + Ability + "!";
            }
            else // is Enemy
            {
                Status = source.Name + "'s skill power is used up.";
            }
        }
Exemple #3
0
        public DamageIcon(StateOfBattle battle, int amount, Combatant receiver, bool mp = false)
            : base(battle, receiver)
        {
            Message = amount.ToString();

            if (mp)
            {
                Message += " MP";
            }

            if (amount < 0)
            {
                Message = Message.Substring(1); // drop minus sign
                Color = Colors.GREEN;
            }
        }
        private PetrifyAbility(Combatant source, Combatant target)
        {
            Name = "Petrify";
            Desc = "Petrification as a result of Slow-Numb";

            Type = AttackType.Physical;
            Target = BattleTarget.Combatant;

            Power = 0;
            Hitp = 255;

            HitFormula = PhysicalHit;

            Statuses = new StatusChange[] { new StatusChange(Status.Petrify, 100, StatusChange.Effect.Inflict) };

            #if DEBUG
            Message = String.Format("[ {0} had slow-numbed {1} ]", source, target);
            #else
            Message = String.Empty;
            #endif
        }
        private DeathAbility(Combatant source, Combatant target)
        {
            Name = "Death";
            Desc = "Death as a result of Death Sentence";

            Type = AttackType.Physical;
            Target = BattleTarget.Combatant;

            Power = 0;
            Hitp = 255;

            HitFormula = PhysicalHit;

            Statuses = new StatusChange[] { new StatusChange(Status.Death, 100, StatusChange.Effect.Inflict) };

            #if DEBUG
            Message = String.Format("[ {0} reaps {1} ]", source, target);
            #else
            Message = String.Empty;
            #endif
        }
        public AbilityEvent(Ability ability, AbilityModifiers modifiers, Combatant source, Combatant[] targets)
            : base(source, modifiers.ResetTurnTimer)
        {
            Hits = new bool[ability.Hits];
            Steals = new string[modifiers.StealAsWell ? targets.Count() : 0];
            TargetHitFlags = new bool[targets.Count()];
            Targets = targets;
            Ability = ability;
            Modifiers = modifiers;

            if (modifiers.StealAsWell)
            {
                if (!(source is Ally))
                {
                    throw new GameDataException("Non-Ally source '{0}' attempted to steal.", source.Name);
                }
                else if (targets.Any(x => !(x is Enemy)))
                {
                    throw new GameDataException("Source '{0}' attempted to steal from a non-Enemy target using ability '{1}'.", source.Name, ability.Name);
                }
            }
        }
        private PoisonAbility(Combatant poisoner, Combatant poisonee)
        {
            Name = "Poison";
            Desc = "Damage as a result of the Poison Status";

            Type = AttackType.Physical;
            Target = BattleTarget.Combatant;

            Elements = new Element[] { Element.Poison };

            Power = 1;
            Hitp = 255;

            DamageFormula = MaxHPPercent;
            HitFormula = PhysicalHit;

            #if DEBUG
            Message = String.Format("[ {0} had poisoned {1} ]", poisoner, poisonee);
            #else
            Message = String.Empty;
            #endif
        }
Exemple #8
0
        public override bool InflictDeath(Combatant source)
        {
            bool inflicted = false;

            if (!Immune(Status.Death) && !(DeathForce || Peerless || Petrify || Resist))
            {
                if (DeathSentence)
                {
                    CureDeathSentence(source);
                }

                if (!_death)
                {
                    CurrentBattle.AddDeathIcon(this);

                    Kill();

                    _death    = true;
                    inflicted = true;
                }
            }

            return(inflicted);
        }
Exemple #9
0
 public bool CurePeerless(Combatant source)
 {
     Peerless        = false;
     PeerlessTimeEnd = -1;
     return(true);
 }
Exemple #10
0
 public void AttackX2(Combatant target, bool resetTurnTimer = true)
 {
     PrimaryAttackX2.Use(this, new Combatant[] { target }, new AbilityModifiers { ResetTurnTimer = resetTurnTimer });
 }
Exemple #11
0
 public bool CureManipulate(Combatant source)
 {
     return(true);
 }
Exemple #12
0
 public override bool CureSadness(Combatant source)
 {
     return(_c.CureSadness());
 }
Exemple #13
0
 public static void Use(Combatant poisoner, Combatant poisonee)
 {
     poisonee.CurrentBattle.EnqueueAction(new PoisonEvent(poisoner, poisonee));
 }
 public PoisonEvent(Combatant poisoner, Combatant poisonee)
     : base(new PoisonAbility(poisoner, poisonee), MODIFIERS, poisoner, new Combatant[] { poisonee })
 {
     Poisonee = poisonee;
 }
Exemple #15
0
        public static void Use(Combatant source, Combatant target)
        {
            DeathAbility ability = new DeathAbility(source, target);

            source.CurrentBattle.EnqueueAction(new AbilityEvent(ability, MODIFIERS, source, new Combatant[] { target }));
        }
Exemple #16
0
 public override bool InflictManipulate(Combatant source)
 {
     return false;
 }
Exemple #17
0
 public override bool InflictSadness(Combatant source)
 {
     if (_c.Immune(Status.Sadness))
     {
         return false;
     }
     return _c.InflictSadness();
 }
Exemple #18
0
        public override bool InflictDeath(Combatant source)
        {
            bool inflicted = false;

            if (!Immune(Status.Death) && !(DeathForce || Peerless || Petrify || Resist))
            {
                if (DeathSentence)
                {
                    CureDeathSentence(source);
                }

                inflicted = _c.InflictDeath();

                if (inflicted)
                {
                    CurrentBattle.AddDeathIcon(this);

                    Kill();
                }
            }

            return inflicted;
        }
Exemple #19
0
 public override bool InflictFury(Combatant source)
 {
     if (_c.Immune(Status.Fury))
     {
         return false;
     }
     return _c.InflictFury();
 }
Exemple #20
0
 public override bool CureSadness(Combatant source)
 {
     return _c.CureSadness();
 }
Exemple #21
0
 public override bool CureFury(Combatant source)
 {
     return _c.CureFury();
 }
Exemple #22
0
        public override bool CureDeath(Combatant source)
        {
            bool cured = _c.CureDeath();

            if (cured)
            {
                CureAll(source);
                UnpauseTimers();
            }

            return cured;
        }
Exemple #23
0
 public DeathIcon(StateOfBattle battle, Combatant receiver)
     : base(battle, receiver)
 {
     Message = DEATH;
 }
Exemple #24
0
        public override void Recover(Combatant source)
        {
            CurrentBattle.AddRecoveryIcon(this);

            if (Death)
            {
                CureDeath(source);
            }

            _c.HP = MaxHP;
            _c.MP = MaxMP;
        }
        public static void Use(Combatant source, Combatant target)
        {
            PetrifyAbility ability = new PetrifyAbility(source, target);

            source.CurrentBattle.EnqueueAction(new AbilityEvent(ability, MODIFIERS, source, new Combatant[] { target }));
        }
Exemple #26
0
 public override string GetMessage(Combatant source)
 {
     return source.Name + " attacks";
 }
 public static void Use(Combatant poisoner, Combatant poisonee)
 {
     poisonee.CurrentBattle.EnqueueAction(new PoisonEvent(poisoner, poisonee));
 }
Exemple #28
0
 public override void SetAsControl()
 {
     base.SetAsControl();
     _target = BattleState.Commanding;
 }
Exemple #29
0
 public void AttackX2(Combatant target, bool resetTurnTimer = true)
 {
     PrimaryAttackX2.Use(this, new Combatant[] { target }, new AbilityModifiers {
         ResetTurnTimer = resetTurnTimer
     });
 }
Exemple #30
0
 public abstract void AcceptMPLoss(Combatant source, int delta);
Exemple #31
0
 public MissIcon(StateOfBattle battle, Combatant receiver)
     : base(battle, receiver)
 {
     Message = MISS;
 }
Exemple #32
0
 public abstract void Recover(Combatant source);
Exemple #33
0
 public override bool InflictManipulate(Combatant source)
 {
     return(false);
 }
Exemple #34
0
 public abstract bool InflictDeath(Combatant source);
Exemple #35
0
 public bool CureShield(Combatant source)
 {
     Shield        = false;
     ShieldTimeEnd = -1;
     return(true);
 }
Exemple #36
0
 public abstract bool InflictFury(Combatant source);
Exemple #37
0
 public bool CureBerserk(Combatant source)
 {
     Berserk = false;
     return(true);
 }
Exemple #38
0
 public abstract bool InflictSadness(Combatant source);
Exemple #39
0
 public bool CureDarkness(Combatant source)
 {
     Darkness = false;
     return(true);
 }
Exemple #40
0
 public abstract bool InflictManipulate(Combatant source);
Exemple #41
0
        public override void AcceptDamage(Combatant source, int delta, AttackType type = AttackType.None)
        {
            CurrentBattle.AddDamageIcon(delta, this);

            // limit shtuff goes here

            if (type == AttackType.Physical)
            {
                if (Sleep)
                {
                    CureSleep(source);
                }
                if (Confusion)
                {
                    CureConfusion(source);
                }
            }

            int hp = _c.HP - delta;

            if (hp < 0)
            {
                hp = 0;
            }
            else if (hp >= _c.MaxHP)
            {
                hp = _c.MaxHP;
            }

            _c.HP = hp;

            if (HP == 0)
            {
                Kill();
            }

            if (source is Enemy)
            {
                LastAttacker = source;

                switch (type)
                {
                    case AttackType.Physical:
                        LastAttackerPhysical = source;
                        break;
                    case AttackType.Magical:
                        LastAttackerMagical = source;
                        break;
                }
            }
        }
Exemple #42
0
 public abstract bool CureDeath(Combatant source);
 public override string GetMessage(Combatant source)
 {
     return Message;
 }
Exemple #44
0
 public abstract bool CureFury(Combatant source);
Exemple #45
0
 public override string GetMessage(Combatant source)
 {
     return source.Name + " casts " + Name;
 }
Exemple #46
0
 public abstract bool CureSadness(Combatant source);
Exemple #47
0
 public RecoveryIcon(StateOfBattle battle, Combatant receiver)
     : base(battle, receiver)
 {
     Message = RECOVERY;
     Color = Colors.GREEN;
 }
Exemple #48
0
 public bool CureConfusion(Combatant source)
 {
     Confusion = false;
     return(true);
 }
Exemple #49
0
            public bool Hits(Combatant source, Combatant target, AbilityModifiers modifiers)
            {
                // auto hit conditions

                if (_odds >= 100)
                {
                    return true;
                }
                if (Statuses.Count() == 1 && Statuses.Contains(Status.Frog) && target.Frog)
                {
                    return true;
                }
                if (Statuses.Count() == 1 && Statuses.Contains(Status.Small) && target.Small)
                {
                    return true;
                }
                if (target is Ally && Statuses.Any(s => new Status[] {
                    Status.Haste,
                    Status.Berserk,
                    Status.Shield
                }.Contains(s)))
                {
                    return true;
                }

                int odds = _odds;

                odds = MPTurbo(odds, modifiers);
                odds = Split(odds, modifiers);
                odds -= 1;

                return source.CurrentBattle.Random.Next(99) < odds;
            }
Exemple #50
0
 protected int PhysicalDamage(int bd, int power, Combatant ee)
 {
     return (power * (512 - ee.Def) * bd) / (16 * 512);
 }
Exemple #51
0
 public override bool CureFury(Combatant source)
 {
     return(_c.CureFury());
 }
Exemple #52
0
 public bool CureFrog(Combatant source)
 {
     Frog = false;
     return(true);
 }
Exemple #53
0
 public override string GetMessage(Combatant source)
 {
     return(source.Name + " attacks");
 }
Exemple #54
0
 public bool CureSmall(Combatant source)
 {
     Small = false;
     return(true);
 }
Exemple #55
0
 public PoisonEvent(Combatant poisoner, Combatant poisonee)
     : base(new PoisonAbility(poisoner, poisonee), MODIFIERS, poisoner, new Combatant[] { poisonee })
 {
     Poisonee = poisonee;
 }
Exemple #56
0
 public bool CureMBarrier(Combatant source)
 {
     MBarrier        = false;
     MBarrierTimeEnd = -1;
     return(true);
 }
Exemple #57
0
 public override string GetMessage(Combatant source)
 {
     return(Message);
 }
Exemple #58
0
 public bool CureReflect(Combatant source)
 {
     Reflect = false;
     return(true);
 }
Exemple #59
0
 public bool CureSilence(Combatant source)
 {
     Silence = false;
     return(true);
 }
Exemple #60
0
        public override void AcceptMPLoss(Combatant source, int delta)
        {
            CurrentBattle.AddDamageIcon(delta, this, true);

            _c.MP -= delta;

            if (source is Enemy)
            {
                LastAttacker = source;
            }
        }