예제 #1
0
        public int ApplyPowerAlwaysCrit(CombatInstance2 inst, BasicMon owner, BasicMon target)
        {
            var mod   = CalculateModAlwaysCrit(inst, owner, target);
            var power = Power;

            (double atkmod, string str)  = owner.ChangeAttStage(0);
            (double defmod, string str2) = target.ChangeDefStage(0);

            if (Result[TargetNum].Crit && owner.GetAttStage() < 0)
            {
                atkmod = 1.0;
            }
            if (Result[TargetNum].Crit && target.GetDefStage() > 0)
            {
                defmod = 1.0;
            }

            if (Type.Type == "Electric" && owner.Status.Charged)
            {
                power *= 2;
                owner.Status.Charged = false;
            }

            double dmg    = (((((2.0 * owner.Level) / 5.0) + 2.0) * power * (((double)owner.CurStats[1] * atkmod) / ((double)target.CurStats[2] * defmod)) / 50) + 2) * mod;
            int    damage = (int)dmg;

            if (damage < 1)
            {
                damage = 1;
            }

            Result[TargetNum].EnemyDmg = damage;

            return(damage);
        }
예제 #2
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();

            foreach (BasicMon t in targets)
            {
                AddResult();

                //Fail logic
                if (DefaultFailLogic(t, owner))
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Miss Logic
                else if (!ApplyAccuracy(inst, owner, t))
                {
                    Result[TargetNum].Miss = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit logic
                else
                {
                    CurrentPP--;
                    var amount = t.TotalHP / 4;
                    t.Restore(amount);
                    (double mod, string mess) = t.ChangeAttStage(-2);
                    Result[TargetNum].StatChangeMessages.Add(mess);

                    Result[TargetNum].EnemyHeal = amount;
                }
            }

            return(Result);
        }
예제 #3
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();

            foreach (BasicMon t in targets)
            {
                AddResult();

                //Fail logic
                if (DefaultFailLogic(t, owner) || t.Status.Asleep || t.Status.Sleepy >= 1)
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Miss Logic
                else if (!ApplyAccuracy(inst, owner, t))
                {
                    Result[TargetNum].Miss = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit logic
                else
                {
                    CurrentPP--;
                    t.Status.Sleepy = 1;
                    Result[TargetNum].Messages.Add($"{t.Nickname} is feeling sleepy...");
                }
            }

            return(Result);
        }
예제 #4
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();

            foreach (BasicMon t in targets)
            {
                AddResult();

                //Fail logic
                if (DefaultFailLogic(t, owner) || t.HasDisabledMove())
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Miss Logic
                else if (!ApplyAccuracy(inst, owner, t))
                {
                    Result[TargetNum].Miss = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit logic
                else
                {
                    CurrentPP--;
                    var move = t.SelectedMove;
                    move.Disabled = true;
                    Result[TargetNum].StatChangeMessages.Add($"{owner.Nickname} disabled {t.Nickname}'s {move.Name}!");
                }
            }

            return(Result);
        }
예제 #5
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();

            foreach (BasicMon t in targets)
            {
                AddResult();

                //Fail logic
                if (DefaultFailLogic(t, owner))
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Miss Logic
                else if (!ApplyAccuracy(inst, owner, t))
                {
                    Result[TargetNum].Miss = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit logic
                else
                {
                    CurrentPP--;
                    var amount = t.TotalHP / 6;
                    owner.Restore(amount);
                    t.TakeDamage(amount);

                    Result[TargetNum].SelfHeal = amount;
                    Result[TargetNum].EnemyDmg = amount;
                }
            }

            return(Result);
        }
예제 #6
0
        ///<summary>
        ///Determines the effectiveness of this move against an enemy based on typing.
        ///</summary>
        public double ModType(BasicMon enemy)
        {
            double type = 1.0;

            if (enemy.OverrideType)
            {
                type = Type.ParseEffectiveness(enemy.OverrideTyping);
            }
            else
            {
                type = Type.ParseEffectiveness(enemy.Typing);
            }

            if (type > 1)
            {
                Result[TargetNum].SuperEffective = true;
            }
            if (type < 1)
            {
                Result[TargetNum].NotEffective = true;
            }
            if (type == 0)
            {
                Result[TargetNum].Immune = true;
            }
            Result[TargetNum].ModType = type;

            return(type);
        }
예제 #7
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            Console.WriteLine("SA");
            ResetResult();
            Console.WriteLine("SB");
            AddResult();
            Console.WriteLine("SC");

            //Fail logic
            if (SelfMoveFailLogic(owner))
            {
                Console.WriteLine("SD");
                Result[TargetNum].Fail = true;
                Console.WriteLine("SE");
                Result[TargetNum].Hit = false;
                Console.WriteLine("SF");
            }
            //Hit logic
            else
            {
                Console.WriteLine("SG");
                CurrentPP--;
                Console.WriteLine("SH");
                Result[TargetNum].Messages.Add(inst.Environment.AttemptSunrise());
                Console.WriteLine("SI");
            }

            return(Result);
        }
예제 #8
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            if (!Buffered)
            {
                ResetResult();
                AddResult();

                //Fail logic
                if (SelfMoveFailLogic(owner))
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit logic
                else
                {
                    CurrentPP--;
                    owner.BufferedMove  = this;
                    owner.Status.Flying = true;
                    Buffered            = true;
                    Result[TargetNum].Messages.Add($"{owner.Nickname} flew up high!");
                }
                return(Result);
            }
            else
            {
                return(ApplyBufferedMove(inst, owner, targets));
            }
        }
예제 #9
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();

            foreach (BasicMon t in targets)
            {
                AddResult();

                //Fail logic
                if (DefaultFailLogic(t, owner))
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit logic
                else
                {
                    CurrentPP--;
                    (double mod, string mess) = t.ChangeDefStage(-2);
                    Result[TargetNum].StatChangeMessages.Add(mess);

                    (double mod1, string mess1) = t.ChangeAttStage(2);
                    Result[TargetNum].StatChangeMessages.Add(mess1);
                }
            }

            return(Result);
        }
예제 #10
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();

            foreach (BasicMon t in targets)
            {
                int dmg = 0;
                AddResult();

                //Fail logic
                if (DefaultFailLogic(t, owner))
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Miss Logic
                else if (!ApplyAccuracy(inst, owner, t))
                {
                    Result[TargetNum].Miss = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit logic
                else
                {
                    CurrentPP--;
                    dmg = ApplyPower(inst, owner, t);
                    t.TakeDamage(dmg);
                    (double mod, string mess) = t.ChangeAttStage(-1);
                    //Result.EnemyStatChanges[1] = -1;
                    Result[TargetNum].StatChangeMessages.Add(mess);
                }
            }

            return(Result);
        }
예제 #11
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();

            foreach (BasicMon t in targets)
            {
                AddResult();

                //Fail logic
                if (DefaultFailLogic(t, owner) || t.HasType("Water"))
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Miss Logic
                else if (!ApplyAccuracy(inst, owner, t))
                {
                    Result[TargetNum].Miss = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit logic
                else
                {
                    CurrentPP--;
                    t.OverrideType = true;
                    t.OverrideTyping.Add(new WaterType(true));
                    Result[TargetNum].Messages.Add($"{t.Nickname} is now a **Water** type!");
                }
            }

            return(Result);
        }
예제 #12
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();

            foreach (BasicMon t in targets)
            {
                AddResult();

                //Fail logic
                if (DefaultFailLogic(t, owner) || StatusFailLogic(t, "Fire"))
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Miss Logic
                else if (!ApplyAccuracy(inst, owner, t))
                {
                    Result[TargetNum].Miss = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit logic
                else
                {
                    CurrentPP--;
                    Result[TargetNum].StatusMessages.Add(t.SetBurned());
                }
            }

            return(Result);
        }
예제 #13
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();

            foreach (BasicMon t in targets)
            {
                AddResult();

                //Fail logic
                if (SelfMoveFailLogic(owner))
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit logic
                else
                {
                    CurrentPP--;
                    t.Status.StatusCure();
                    var amount = t.TotalHP / 10;
                    t.Restore(amount);
                    Result[TargetNum].SelfHeal = amount;

                    (double mod, string mess) = t.ChangeAttStage(1);
                    Result[TargetNum].StatChangeMessages.Add(mess);

                    (double mod1, string mess1) = t.ChangeAffStage(1);
                    Result[TargetNum].StatChangeMessages.Add(mess1);
                }
            }

            return(Result);
        }
예제 #14
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();

            foreach (BasicMon t in targets)
            {
                int dmg = 0;
                AddResult();

                //Fail logic
                if (DefaultFailLogic(t, owner))
                {
                    Result[TargetNum].Fail = true;
                    Result[TargetNum].Hit  = false;
                }
                //Miss Logic
                else if (!ApplyAccuracy(inst, owner, t))
                {
                    Result[TargetNum].Miss = true;
                    Result[TargetNum].Hit  = false;
                }
                //Hit Logic
                else
                {
                    CurrentPP--;
                    dmg = ApplyPower(inst, owner, t);
                    t.TakeDamage(dmg);
                }
            }

            return(Result);
        }
예제 #15
0
        ///<summary>
        ///Calculates the total damage modifier
        ///<para>CritMod * RandomMod * TypeMod</para>
        ///</summary>
        public double CalculateMod(CombatInstance2 inst, BasicMon owner, BasicMon enemy)
        {
            var mod = ModCrit(inst, owner) * ModRandom() * ModType(enemy) * ModWeather(inst);

            Result[TargetNum].Mod = mod;
            Console.WriteLine($"Mod: {mod}");
            return(mod);
        }
예제 #16
0
 public override async Task mon_EnteredCombat(BasicMon owner, CombatInstance2 inst)
 {
     foreach (BasicMon enemy in inst.GetAllEnemies(owner))
     {
         enemy.ChangeAttStage(-1);
         await MessageHandler.SendMessage(inst.Location, $"{owner.Nickname} intimidates {enemy.Nickname}, lowering their attack by one stage!");
     }
 }
예제 #17
0
        public async Task FaintMon(BasicMon mon)
        {
            var user = UserHandler.GetUser(mon.OwnerID);

            mon.Fainted = true;
            await MessageHandler.Faint(Location, user, mon);

            user.Char.ActiveMons.Remove(mon);
            mon.ExitCombat();
        }
예제 #18
0
 public bool StatusFailLogic(BasicMon enemy, string type)
 {
     if (enemy.TypingToString().Contains(type) || enemy.Status.Burned || enemy.Status.Paraylzed || enemy.Status.Poisoned || enemy.Status.BadlyPoisoned || enemy.Status.Frozen || enemy.Status.Asleep)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #19
0
        public bool VolatileStatusFailCheck(BasicMon owner)
        {
            if (owner.Status.Flinching == true)
            {
                Result[TargetNum].FailText = $"{owner.Nickname} flinched!";
                owner.Status.Flinching     = false;
                return(true);
            }

            return(false);
        }
예제 #20
0
 public bool HasMonInParty(BasicMon mon)
 {
     foreach (BasicMon m in Party)
     {
         if (mon == m)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #21
0
 public bool SelfMoveFailLogicIgnoreStatus(BasicMon owner)
 {
     Result[TargetNum].Owner = owner;
     if (VolatileStatusFailCheck(owner) || owner.Fainted)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #22
0
 ///<summary>
 ///Rolls to determine if the move hit or not- true = hit false = miss
 ///</summary>
 public bool ApplyAccuracy(CombatInstance2 inst, BasicMon owner, BasicMon target)
 {
     if (Accuracy >= 0)
     {
         var  adjustedAccuracy = Accuracy * owner.StatModAccEva(target.GetEvaStage());
         bool result           = RandomGen.PercentChance(adjustedAccuracy);
         Result[TargetNum].ChanceToHit = adjustedAccuracy;
         return(result);
     }
     else
     {
         return(true);
     }
 }
예제 #23
0
        public UserAccount GetPlayer(BasicMon mon)
        {
            foreach (Team t in Teams)
            {
                foreach (UserAccount u in t.Members)
                {
                    if (u.Char.HasMonInParty(mon))
                    {
                        return(u);
                    }
                }
            }

            return(null);
        }
예제 #24
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();
            Console.WriteLine($"TA");

            foreach (BasicMon t in targets)
            {
                Console.WriteLine($"TB");
                int dmg = 0;
                Console.WriteLine($"TC");
                AddResult();
                Console.WriteLine($"TD");

                //Fail logic
                if (DefaultFailLogic(t, owner))
                {
                    Console.WriteLine($"TE");
                    Result[TargetNum].Fail = true;
                    Console.WriteLine($"TF");
                    Result[TargetNum].Hit = false;
                    Console.WriteLine($"TG");
                }
                //Miss Logic
                else if (!ApplyAccuracy(inst, owner, t))
                {
                    Console.WriteLine($"TH");
                    Result[TargetNum].Miss = true;
                    Console.WriteLine($"TI");
                    Result[TargetNum].Hit = false;
                    Console.WriteLine($"TJ");
                }
                //Hit Logic
                else
                {
                    Console.WriteLine($"TK");
                    CurrentPP--;
                    Console.WriteLine($"TL");
                    dmg = ApplyPower(inst, owner, t);
                    Console.WriteLine($"TM");
                    t.TakeDamage(dmg);
                    Console.WriteLine($"TN");
                }
                Console.WriteLine($"TO");
            }
            Console.WriteLine($"TP");

            return(Result);
        }
예제 #25
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();
            AddResult();
            var player = inst.GetPlayer(owner);
            var chara  = player.Char;

            //Fail logic
            if (SelfMoveFailLogic(owner) || !chara.HasUsableMon())
            {
                Result[TargetNum].Fail = true;
                Result[TargetNum].Hit  = false;
            }
            //Hit logic
            else
            {
                CurrentPP--;
                var mon = chara.FirstUsableMon(new List <BasicMon> {
                    owner
                });
                Result[TargetNum].Swapout = mon;
                Result[TargetNum].Messages.Add($"**{owner.Nickname}** teleports away and {player.Mention} sends out **{mon.Nickname}**!");

                foreach (BasicMon m in inst.GetAllMons())
                {
                    if (m.SelectedMove != null)
                    {
                        for (int i = 0; i < m.SelectedMove.Targets.Count; i++)
                        {
                            if (m.SelectedMove.Targets[i] == owner)
                            {
                                m.SelectedMove.Targets[i] = mon;
                            }
                        }
                        for (int i = 0; i < m.SelectedMove.ValidTargets.Count; i++)
                        {
                            if (m.SelectedMove.ValidTargets[i] == owner)
                            {
                                m.SelectedMove.ValidTargets[i] = mon;
                            }
                        }
                    }
                }
            }

            return(Result);
        }
예제 #26
0
        public bool StatusFailCheck(BasicMon owner)
        {
            if (owner.Status.Flinching == true)
            {
                Result[TargetNum].FailText = $"{owner.Nickname} flinched!";
                owner.Status.Flinching     = false;
                return(true);
            }
            if (owner.Status.Paraylzed == true)
            {
                if (RandomGen.PercentChance(25.0))
                {
                    Result[TargetNum].FailText = $"{owner.Nickname} is paralyzed!";
                    return(true);
                }
            }
            if (owner.Status.Asleep == true)
            {
                if (owner.Status.SleepTick())
                {
                    Result[TargetNum].Messages.Add($"{owner.Nickname} has woken up!");
                    return(false);
                }
                else
                {
                    Result[TargetNum].FailText = $"{owner.Nickname} is asleep!";
                    return(true);
                }
            }
            if (owner.Status.Frozen == true)
            {
                if (owner.Status.FreezeTick())
                {
                    Result[TargetNum].Messages.Add($"{owner.Nickname} has unfrozen!");
                    return(false);
                }
                else
                {
                    Result[TargetNum].FailText = $"{owner.Nickname} is frozen!";
                    return(true);
                }
            }

            return(false);
        }
예제 #27
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();
            AddResult();

            //Fail logic
            if (SelfMoveFailLogic(owner))
            {
                Result[TargetNum].Fail = true;
                Result[TargetNum].Hit  = false;
            }
            //Hit logic
            else
            {
                CurrentPP--;
                Result[TargetNum].Messages.Add(inst.Environment.AttemptHeatwave());
            }

            return(Result);
        }
예제 #28
0
        public List <BasicMon> GetAllEnemies(BasicMon mon)
        {
            List <BasicMon> mons = new List <BasicMon>();

            foreach (Team t in Teams)
            {
                if (!t.Members.Contains(UserHandler.GetUser(mon.OwnerID)))
                {
                    foreach (UserAccount u in t.Members)
                    {
                        foreach (BasicMon m in u.Char.ActiveMons)
                        {
                            mons.Add(m);
                        }
                    }
                }
            }

            return(mons);
        }
예제 #29
0
        public async Task StartCombat()
        {
            //Make sure all users have a valid party
            foreach (Team t in Teams)
            {
                foreach (UserAccount u in t.Members)
                {
                    if (!u.Char.HasLivingParty())
                    {
                        ExitCombatAll();
                        await MessageHandler.SendMessage(Location, $"Duel canceled! {u.Mention} does not have a valid party.");

                        return;
                    }
                }
            }

            //Send out all mons. (NEEDS EDITING- COULD BE MORE THAN 2 TEAMS)
            await MessageHandler.SendMessage(Location, $"The battle between Team {Teams[0].TeamName} and Team {Teams[1].TeamName} will now begin!");

            foreach (Team t in Teams)
            {
                foreach (UserAccount u in t.Members)
                {
                    for (int i = 0; i < t.MultiNum; i++)
                    {
                        if (u.Char.HasUsableMon())
                        {
                            BasicMon sentMon = u.Char.FirstUsableMon();
                            u.Char.ActiveMons.Add(sentMon);
                            sentMon.IsCombatActive = true;
                            //sentMon.OnEnteredCombat(this);
                            await MessageHandler.SendEmbedMessage(Location, $"{u.Mention} sends out **{sentMon.Nickname}**!", MonEmbedBuilder.FieldMon(sentMon));
                        }
                    }
                }
            }

            CombatPhase = 0;
            await ResolvePhase();
        }
예제 #30
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();
            AddResult();

            //Fail logic
            if (SelfMoveFailLogic(owner) || owner.Status.Charged)
            {
                Result[TargetNum].Fail = true;
                Result[TargetNum].Hit  = false;
            }
            //Hit logic
            else
            {
                CurrentPP--;
                owner.Status.Charged = true;
                Result[TargetNum].Messages.Add($"{owner.Nickname} charges up!");
            }

            return(Result);
        }