Beispiel #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.";
            }
        }
Beispiel #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
        }
Beispiel #5
0
        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
        }
Beispiel #6
0
        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);
                }
            }
        }
Beispiel #7
0
        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
        }
Beispiel #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);
        }
Beispiel #9
0
 public bool CurePeerless(Combatant source)
 {
     Peerless        = false;
     PeerlessTimeEnd = -1;
     return(true);
 }
Beispiel #10
0
 public void AttackX2(Combatant target, bool resetTurnTimer = true)
 {
     PrimaryAttackX2.Use(this, new Combatant[] { target }, new AbilityModifiers { ResetTurnTimer = resetTurnTimer });
 }
Beispiel #11
0
 public bool CureManipulate(Combatant source)
 {
     return(true);
 }
Beispiel #12
0
 public override bool CureSadness(Combatant source)
 {
     return(_c.CureSadness());
 }
Beispiel #13
0
 public static void Use(Combatant poisoner, Combatant poisonee)
 {
     poisonee.CurrentBattle.EnqueueAction(new PoisonEvent(poisoner, poisonee));
 }
Beispiel #14
0
 public PoisonEvent(Combatant poisoner, Combatant poisonee)
     : base(new PoisonAbility(poisoner, poisonee), MODIFIERS, poisoner, new Combatant[] { poisonee })
 {
     Poisonee = poisonee;
 }
Beispiel #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 }));
        }
Beispiel #16
0
 public override bool InflictManipulate(Combatant source)
 {
     return false;
 }
Beispiel #17
0
 public override bool InflictSadness(Combatant source)
 {
     if (_c.Immune(Status.Sadness))
     {
         return false;
     }
     return _c.InflictSadness();
 }
Beispiel #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;
        }
Beispiel #19
0
 public override bool InflictFury(Combatant source)
 {
     if (_c.Immune(Status.Fury))
     {
         return false;
     }
     return _c.InflictFury();
 }
Beispiel #20
0
 public override bool CureSadness(Combatant source)
 {
     return _c.CureSadness();
 }
Beispiel #21
0
 public override bool CureFury(Combatant source)
 {
     return _c.CureFury();
 }
Beispiel #22
0
        public override bool CureDeath(Combatant source)
        {
            bool cured = _c.CureDeath();

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

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

            if (Death)
            {
                CureDeath(source);
            }

            _c.HP = MaxHP;
            _c.MP = MaxMP;
        }
Beispiel #25
0
        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 }));
        }
Beispiel #26
0
 public override string GetMessage(Combatant source)
 {
     return source.Name + " attacks";
 }
Beispiel #27
0
 public static void Use(Combatant poisoner, Combatant poisonee)
 {
     poisonee.CurrentBattle.EnqueueAction(new PoisonEvent(poisoner, poisonee));
 }
Beispiel #28
0
 public override void SetAsControl()
 {
     base.SetAsControl();
     _target = BattleState.Commanding;
 }
Beispiel #29
0
 public void AttackX2(Combatant target, bool resetTurnTimer = true)
 {
     PrimaryAttackX2.Use(this, new Combatant[] { target }, new AbilityModifiers {
         ResetTurnTimer = resetTurnTimer
     });
 }
Beispiel #30
0
 public abstract void AcceptMPLoss(Combatant source, int delta);
Beispiel #31
0
 public MissIcon(StateOfBattle battle, Combatant receiver)
     : base(battle, receiver)
 {
     Message = MISS;
 }
Beispiel #32
0
 public abstract void Recover(Combatant source);
Beispiel #33
0
 public override bool InflictManipulate(Combatant source)
 {
     return(false);
 }
Beispiel #34
0
 public abstract bool InflictDeath(Combatant source);
Beispiel #35
0
 public bool CureShield(Combatant source)
 {
     Shield        = false;
     ShieldTimeEnd = -1;
     return(true);
 }
Beispiel #36
0
 public abstract bool InflictFury(Combatant source);
Beispiel #37
0
 public bool CureBerserk(Combatant source)
 {
     Berserk = false;
     return(true);
 }
Beispiel #38
0
 public abstract bool InflictSadness(Combatant source);
Beispiel #39
0
 public bool CureDarkness(Combatant source)
 {
     Darkness = false;
     return(true);
 }
Beispiel #40
0
 public abstract bool InflictManipulate(Combatant source);
Beispiel #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;
                }
            }
        }
Beispiel #42
0
 public abstract bool CureDeath(Combatant source);
Beispiel #43
0
 public override string GetMessage(Combatant source)
 {
     return Message;
 }
Beispiel #44
0
 public abstract bool CureFury(Combatant source);
Beispiel #45
0
 public override string GetMessage(Combatant source)
 {
     return source.Name + " casts " + Name;
 }
Beispiel #46
0
 public abstract bool CureSadness(Combatant source);
Beispiel #47
0
 public RecoveryIcon(StateOfBattle battle, Combatant receiver)
     : base(battle, receiver)
 {
     Message = RECOVERY;
     Color = Colors.GREEN;
 }
Beispiel #48
0
 public bool CureConfusion(Combatant source)
 {
     Confusion = false;
     return(true);
 }
Beispiel #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;
            }
Beispiel #50
0
 protected int PhysicalDamage(int bd, int power, Combatant ee)
 {
     return (power * (512 - ee.Def) * bd) / (16 * 512);
 }
Beispiel #51
0
 public override bool CureFury(Combatant source)
 {
     return(_c.CureFury());
 }
Beispiel #52
0
 public bool CureFrog(Combatant source)
 {
     Frog = false;
     return(true);
 }
Beispiel #53
0
 public override string GetMessage(Combatant source)
 {
     return(source.Name + " attacks");
 }
Beispiel #54
0
 public bool CureSmall(Combatant source)
 {
     Small = false;
     return(true);
 }
Beispiel #55
0
 public PoisonEvent(Combatant poisoner, Combatant poisonee)
     : base(new PoisonAbility(poisoner, poisonee), MODIFIERS, poisoner, new Combatant[] { poisonee })
 {
     Poisonee = poisonee;
 }
Beispiel #56
0
 public bool CureMBarrier(Combatant source)
 {
     MBarrier        = false;
     MBarrierTimeEnd = -1;
     return(true);
 }
Beispiel #57
0
 public override string GetMessage(Combatant source)
 {
     return(Message);
 }
Beispiel #58
0
 public bool CureReflect(Combatant source)
 {
     Reflect = false;
     return(true);
 }
Beispiel #59
0
 public bool CureSilence(Combatant source)
 {
     Silence = false;
     return(true);
 }
Beispiel #60
0
        public override void AcceptMPLoss(Combatant source, int delta)
        {
            CurrentBattle.AddDamageIcon(delta, this, true);

            _c.MP -= delta;

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