Exemple #1
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, "Electric"))
                {
                    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.SetParalysis());
                }
            }

            return(Result);
        }
Exemple #2
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);
        }
Exemple #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))
                {
                    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);
        }
Exemple #4
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);
        }
Exemple #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;
                }
                //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);
        }
Exemple #6
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);
        }
Exemple #7
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);
        }
Exemple #8
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);
        }
Exemple #9
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);
        }
 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!");
     }
 }
Exemple #11
0
        public static void StoreInstance(int key, CombatInstance2 inst)
        {
            if (_dic.ContainsKey(key))
            {
                _dic[key] = inst;
                return;
            }

            _dic.Add(key, inst);

            SaveInstances();
        }
Exemple #12
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);
     }
 }
Exemple #13
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);
        }
Exemple #14
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);
        }
Exemple #15
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);
        }
Exemple #16
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);
        }
Exemple #17
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--;
                (double mod, string mess) = owner.ChangeDefStage(1);
                Result[TargetNum].StatChangeMessages.Add(mess);
            }

            return(Result);
        }
Exemple #18
0
        ///<summary>
        ///Rolls for a critical hit based on crit chance. Returns 1.5 if a crit lands.
        ///</summary>
        public double ModCrit(CombatInstance2 instance, BasicMon owner)
        {
            switch (owner.CritChance)
            {
            case 0:
                if (RandomGen.PercentChance(6.25))
                {
                    Result[TargetNum].Crit    = true;
                    Result[TargetNum].ModCrit = 1.5;
                    return(1.5);
                }
                break;

            case 1:
                if (RandomGen.PercentChance(12.5))
                {
                    Result[TargetNum].Crit    = true;
                    Result[TargetNum].ModCrit = 1.5;
                    return(1.5);
                }
                break;

            case 2:
                if (RandomGen.PercentChance(50.0))
                {
                    Result[TargetNum].Crit    = true;
                    Result[TargetNum].ModCrit = 1.5;
                    return(1.5);
                }
                break;

            default:
                Result[TargetNum].Crit    = true;
                Result[TargetNum].ModCrit = 1.5;
                return(1.5);
            }

            return(1.0);
        }
Exemple #19
0
        public override List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
        {
            ResetResult();
            AddResult();

            //Fail logic
            if (SelfMoveFailLogicIgnoreStatus(owner))
            {
                Result[TargetNum].Fail = true;
                Result[TargetNum].Hit  = false;
            }
            //Hit logic
            else
            {
                CurrentPP--;
                owner.Status.StatusCure();
                Result[TargetNum].StatusMessages.Add(owner.SetAsleep(2));
                owner.CurrentHP = owner.TotalHP;
            }

            return(Result);
        }
Exemple #20
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 = ApplyPowerAlwaysCrit(inst, owner, t);
                    t.TakeDamage(dmg);
                    if (RandomGen.PercentChance(10.0))
                    {
                        Result[TargetNum].StatusMessages.Add(t.SetFrozen());
                    }
                }
            }

            return(Result);
        }
 public virtual async Task mon_EnteredCombat(BasicMon owner, CombatInstance2 inst)
 {
     await Task.Run(null);
 }
Exemple #22
0
 public virtual List <MoveResult> ApplyBufferedMove(CombatInstance2 inst, BasicMon owner, List <BasicMon> targets)
 {
     return(Result);
 }
Exemple #23
0
 public virtual List <MoveResult> ApplyMove(CombatInstance2 inst, BasicMon owner)
 {
     return(Result);
 }
Exemple #24
0
        public List <BasicMon> DetermineValidTargets(CombatInstance2 inst, BasicMon owner)
        {
            List <BasicMon> targets = new List <BasicMon>();

            switch (TargetType)
            {
            case "None":
                return(targets);

            case "Self":
                targets.Add(owner);
                return(targets);

            case "SingleEnemy":
            case "AllEnemies":
                foreach (Team t in inst.Teams)
                {
                    if (!t.Members.Contains(inst.GetPlayer(owner)))
                    {
                        foreach (UserAccount u in t.Members)
                        {
                            foreach (BasicMon mon in u.Char.ActiveMons)
                            {
                                if (!mon.Fainted && mon != null)
                                {
                                    targets.Add(mon);
                                }
                            }
                        }
                    }
                }
                return(targets);

            case "SingleAlly":
            case "AllAllies":
                foreach (Team t in inst.Teams)
                {
                    if (t.Members.Contains(inst.GetPlayer(owner)))
                    {
                        foreach (UserAccount u in t.Members)
                        {
                            foreach (BasicMon mon in u.Char.ActiveMons)
                            {
                                if (!mon.Fainted && mon != null)
                                {
                                    targets.Add(mon);
                                }
                            }
                        }
                    }
                }
                return(targets);

            case "All":
            case "SingleAll":
                foreach (Team t in inst.Teams)
                {
                    foreach (UserAccount u in t.Members)
                    {
                        foreach (BasicMon mon in u.Char.ActiveMons)
                        {
                            if (!mon.Fainted && mon != null && mon != owner)
                            {
                                targets.Add(mon);
                            }
                        }
                    }
                }
                return(targets);

            default:
                Console.WriteLine($"The move {Name} has an unkown TargetType.");
                break;
            }

            ValidTargets = targets;
            return(targets);
        }
Exemple #25
0
 public static void EndCombat(CombatInstance2 inst)
 {
     _dic.Remove(inst.Teams[0].Members[0].Char.CombatId);
     SaveInstances();
 }
Exemple #26
0
 public void OnEnteredCombat(CombatInstance2 inst)
 {
     EnteredCombat?.Invoke(this, inst);
 }