/// <summary>
        /// Returns the BaseMove learned at the specified level. Don't use to get moves for a level 1, instead use BaseMove.DefaultMoves().
        /// </summary>
        /// <param name="t">The ParentPokemon type</param>
        /// <param name="targetlevel">The query level to search the database for</param>
        /// <returns></returns>

        public static BaseMove LearnAt(ParentPokemon t, int targetlevel)
        {
            string match = t.Name;

            foreach (MoveDb pokemon in moveDb) // Loop through MoveDb
            {
                if (pokemon.Name == match)
                {
                    foreach (Dictionary <string, long> move in pokemon.LearnAtLevel)
                    {
                        foreach (string key in move.Keys)
                        {
                            if (move[key] == targetlevel)
                            {
                                BaseMove type = TerramonMod.GetMove(key);
                                if (type == null)
                                {
                                    return(null);
                                }
                                return(type);
                            }
                        }
                    }
                }
            }
            return(null);
        }
        /// <summary>
        /// Returns a string array of the move names that this Pokemon learns at level 1. Use TerramonMod.GetMove(string) to get BaseMove instances from the returned move names.
        /// </summary>
        /// <param name="t">The ParentPokemon type</param>
        /// <returns></returns>

        public static string[] DefaultMoves(ParentPokemon t)
        {
            string match = t.Name;
            int    c     = 0;

            string[] defaults = new string[] { "None", "None", "None", "None" };
            foreach (MoveDb pokemon in moveDb) // Loop through MoveDb
            {
                if (pokemon.Name == match)
                {
                    foreach (Dictionary <string, long> move in pokemon.LearnAtLevel)
                    {
                        foreach (string key in move.Keys)
                        {
                            if (move[key] == 1)
                            {
                                defaults[c] = key;
                                c++;
                            }
                        }
                    }
                    c = 0;
                    return(defaults);
                }
            }
            return(null);
        }
Beispiel #3
0
 public override void CheckIfAffects(ParentPokemon target, PokemonData deffender, BattleState state, bool opponent)
 {
     if (target.PokemonTypes.Contains(PokemonType.Ghost) && MoveType == PokemonType.Normal ||
         target.PokemonTypes.Contains(PokemonType.Ghost) && MoveType == PokemonType.Fighting ||
         target.PokemonTypes.Contains(PokemonType.Steel) && MoveType == PokemonType.Poison ||
         target.PokemonTypes.Contains(PokemonType.Flying) && MoveType == PokemonType.Ground ||
         target.PokemonTypes.Contains(PokemonType.Normal) && MoveType == PokemonType.Ghost ||
         target.PokemonTypes.Contains(PokemonType.Ground) && MoveType == PokemonType.Electric ||
         target.PokemonTypes.Contains(PokemonType.Dark) && MoveType == PokemonType.Psychic ||
         target.PokemonTypes.Contains(PokemonType.Fairy) && MoveType == PokemonType.Dragon)
     {
         if (opponent)
         {
             BattleMode.UI.splashText.SetText($"It doesn't affect {deffender.PokemonName}!");
         }
         else if (state == BattleState.BattleWithWild)
         {
             BattleMode.UI.splashText.SetText($"It doesn't affect the wild {deffender.PokemonName}...");
         }
         else if (state == BattleState.BattleWithPlayer)
         {
             BattleMode.UI.splashText.SetText($"It doesn't affect the foe's {deffender.PokemonName}...");
         }
         BattleMode.endMoveTimer = -120;
         BattleMode.animWindow   = 1600;
         MoveSound?.Stop();
     }
 }
Beispiel #4
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1) //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140)
            {
                BattleMode.UI.splashText.SetText("");

                TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);

                MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
            }
            else if (AnimationFrame == 155)
            {
                for (float k = 0; k < MathHelper.TwoPi; k += 1.1f)
                {
                    var d = Dust.NewDustPerfect(target.projectile.Center, 90, Vector2.One.RotatedBy(k) * 2f);
                    d.noGravity = true;
                    var d2 = Dust.NewDustPerfect(target.projectile.Center, 90, Vector2.One.RotatedBy(k) * 2f);
                    d2.noGravity = true;
                    var d3 = Dust.NewDustPerfect(target.projectile.Center, 90, Vector2.One.RotatedBy(k) * 2f);
                    d3.noGravity = true;
                    var d4 = Dust.NewDustPerfect(target.projectile.Center, 90, Vector2.One.RotatedBy(k) * 2f);
                    d4.noGravity = true;
                    var d5 = Dust.NewDustPerfect(target.projectile.Center, 90, Vector2.One.RotatedBy(k) * 2f);
                    d5.noGravity = true;
                }
            }
            else if (AnimationFrame == 180)
            {
                InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                {
                    CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                }
                BattleMode.queueEndMove = true;
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                AnimationFrame     = 0;
                BattleMode.moveEnd = false;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            ParentPokemon parentPokemon = db.ParentPokemon.Find(id);

            db.ParentPokemon.Remove(parentPokemon);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #6
0
        public override int AutoUseWeight(ParentPokemon mon, Vector2 pos, TerramonPlayer player)
        {
            NPC target = GetNearestNPC(pos);

            if (target == null)
            {
                return(0);
            }
            return(30);
        }
 public ActionResult Edit([Bind(Include = "ID,Name,Categorie,Status")] ParentPokemon parentPokemon)
 {
     if (ModelState.IsValid)
     {
         db.Entry(parentPokemon).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(parentPokemon));
 }
Beispiel #8
0
        public override int Cooldown => 20 * 60; //20 sec cooldown

        public override int AutoUseWeight(Projectile proj, ParentPokemon mon, Vector2 target, TerramonPlayer player)
        {
            Player pl = Main.player[player.whoAmI];

            if (!(pl.statLife < pl.statLifeMax - (100 * (pl.statLifeMax / 500f))))
            {
                return(0);
            }
            return((int)Math.Round(100 * ((float)pl.statLife / pl.statLifeMax))); // The less hp left, the more chance to cast
        }
        public override void UpdateInventory(Player player)
        {
            currentWaitTime++;
            if (currentWaitTime < WaitTime * 60)
            {
                return;
            }

            if (PokemonName == null || PokemonName == string.Empty)
            {
                item.TurnToAir();//This is invalid item
                return;
            }

            ParentPokemon hatchedPokemon = TerramonMod.GetPokemon(PokemonName);
            string        pokemonName    = hatchedPokemon?.GetType().Name;

            if (player.whoAmI != Main.myPlayer)
            {
                return;
            }

            switch (Main.netMode)
            {
            case NetmodeID.MultiplayerClient:
            {
                var packet = new BaseCatchPacket();
                packet.Send((TerramonMod)mod, pokemonName, pokemonName, player.getRect(),
                            ItemType <PokeballCaught>());
                break;
            }

            case NetmodeID.Server:
            {
                BaseCaughtClass.writeDetour(pokemonName, pokemonName,
                                            GetSmallSpritePath(pokemonName), 1, "", false); //This force server to write data when SetDefault() was called
                Item.NewItem(player.position, ItemType <PokeballCaught>());                 // Within this call SetDefault was called
                break;
            }

            default:
            {
                int             pokeballIndex = Item.NewItem(player.position, ItemType <PokeballCaught>());
                BaseCaughtClass pokeballItem  = Main.item[pokeballIndex].modItem as BaseCaughtClass;
                pokeballItem.PokemonName     = pokeballItem.CapturedPokemon = pokemonName;
                pokeballItem.SmallSpritePath = GetSmallSpritePath(pokemonName);
                break;
            }
            }

            Main.NewText(player.name + " the " + pokemonName + " Egg has hatched!", Color.Orange);
            player.ConsumeItem(item.type);
            currentWaitTime = 0;
        }
        public ActionResult Create([Bind(Include = "ID,Name,Categorie,Status")] ParentPokemon parentPokemon)
        {
            if (ModelState.IsValid)
            {
                db.ParentPokemon.Add(parentPokemon);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(parentPokemon));
        }
Beispiel #11
0
 /// <summary>
 /// Restores HP to a given Pokemon
 /// </summary>
 /// <param name="pokemon">The Pokemon data of the target</param>
 /// <param name="target">The Pokemon projectile of the target</param>
 /// <param name="amount">The integer amount to heal</param>
 public int SelfHeal(PokemonData pokemon, ParentPokemon target, int amount)
 {
     Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/Heal0").WithVolume(.8f));
     if (pokemon.HP + amount > pokemon.MaxHP)
     {
         amount = pokemon.HP + amount - pokemon.MaxHP;
     }
     pokemon.HP         += amount;
     target.healedHealth = true;
     return(amount);
 }
Beispiel #12
0
        public override bool PerformInWorld(Projectile proj, ParentPokemon mon, Vector2 target, TerramonPlayer player)
        {
            Player pl = Main.player[player.whoAmI];

            if (pl.statLife < pl.statLifeMax - (100 * ((float)pl.statLifeMax / 500f))) //The more hp player have the more hp threshold
            {
                pl.HealEffect(200 * (pl.statLifeMax / 500));
                pl.statLife += 200;
                return(true);
            }
            return(false);
        }
Beispiel #13
0
        public override bool PerformInBattle(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                             PokemonData deffender, BaseMove move)
        {
            var heal = (int)(attacker.MaxHP * 0.35f);
            var d    = attacker.HP;

            attacker.HP += heal;
            d            = attacker.HP - d;
            CombatText.NewText(mon.projectile.Hitbox, CombatText.HealLife, d, true);
            PostTextLoc.Args = new object[] { attacker.PokemonName, d };
            return(true);
        }
        /// <summary>
        /// Returns a string array of the moves that the specified Pokemon would know at the specified level. Make sure to check for null, because this can return arrays with varying length.
        /// </summary>
        /// <param name="t">The ParentPokemon type</param>
        /// <param name="targetlevel">Level to index</param>
        /// <returns></returns>

        public static string[] AIMoveset(ParentPokemon t, int targetlevel)
        {
            string match = t.Name;

            string[] set  = new string[] { "None", "None", "None", "None" };
            var      lvls = new List <int>();

            foreach (MoveDb pokemon in moveDb) // Loop through MoveDb
            {
                if (pokemon.Name == match)
                {
                    foreach (Dictionary <string, long> move in pokemon.LearnAtLevel)
                    {
                        foreach (string key in move.Keys)
                        {
                            lvls.Add((int)move[key]); // Add every target move level to list
                        }
                    }

                    lvls.Sort();    // eg. 1, 3, 5, 10, 18
                    lvls.Reverse(); // eg. 18, 10, 5, 3, 1

                    var goodlvls     = new List <int>();
                    var goodlvlnames = new List <string>();

                    foreach (int l in lvls)
                    {
                        if (l <= targetlevel)
                        {
                            goodlvls.Add(l);
                        }
                    }

                    foreach (int level in goodlvls)
                    {
                        foreach (Dictionary <string, long> move in pokemon.LearnAtLevel)
                        {
                            foreach (string key in move.Keys)
                            {
                                if (move[key] == level)
                                {
                                    goodlvlnames.Add(key);
                                }
                            }
                        }
                    }

                    return(goodlvlnames.GetRange(0, goodlvls.Count).ToArray());
                }
            }
            return(null);
        }
Beispiel #15
0
 public override bool PerformInBattle(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                      PokemonData deffender, BaseMove move)
 {
     if (player == null)
     {
         BattleMode.UI.splashText.SetText($"The wild {attacker.PokemonName} used {MoveName}!");
     }
     else
     {
         BattleMode.UI.splashText.SetText($"{attacker.PokemonName} used {MoveName}!");
     }
     return(true);
 }
        // GET: ParentPokemons/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ParentPokemon parentPokemon = db.ParentPokemon.Find(id);

            if (parentPokemon == null)
            {
                return(HttpNotFound());
            }
            return(View(parentPokemon));
        }
        /// <summary>
        /// Get a full dictionary of all moves the specified Pokemon can learn via level up.
        /// </summary>
        /// <param name="t">The ParentPokemon type to get the learnset of</param>
        /// <returns>A dictionary of all learnable moves</returns>
        public virtual Dictionary <string, long>[] Learnset(ParentPokemon t)
        {
            string match = t.Name;

            MoveDb[] database = moveDb;
            foreach (MoveDb pokemon in database) // Loop through MoveDb
            {
                if (pokemon.Name == match)
                {
                    return(pokemon.LearnAtLevel);
                }
            }
            return(null);
        }
Beispiel #18
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1) //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140)
            {
                BattleMode.UI.splashText.SetText("");

                TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 165)
            {
                MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                cutID     = Projectile.NewProjectile(target.projectile.Center, new Vector2(0, 0), ModContent.ProjectileType <CutProjectile>(), 0, 0);
                Main.projectile[cutID].maxPenetrate    = 99;
                Main.projectile[cutID].penetrate       = 99;
                Main.projectile[cutID].direction       = mon.projectile.Center.X > target.projectile.Center.X ? -1 : 1;
                Main.projectile[cutID].spriteDirection = mon.projectile.Center.X > target.projectile.Center.X ? -1 : 1;
            }
            else if (AnimationFrame == 200)
            {
                InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                {
                    CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                }
                BattleMode.queueEndMove = true;
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                AnimationFrame     = 0;
                BattleMode.moveEnd = false;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1) //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140) //Move animation begin after 140 frames
            {
                BattleMode.UI.splashText.SetText("");

                MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
            }

            if (AnimationFrame > 140 && AnimationFrame < 195)
            {
                for (int i = 0; i < 1; i++)
                {
                    Dust dust1 = Dust.NewDustDirect(mon.projectile.position, mon.projectile.width, mon.projectile.height, 174, 0f, 0f, 0, Color.White, 1.1f);
                    dust1.alpha      = 50;
                    dust1.velocity.Y = -1.5f;
                    dust1.noGravity  = true;
                }
            }

            if (AnimationFrame == 275)
            {
                s = ModifyStat(attacker, mon, GetStat.CritRatio, 1, state, !opponent).ToString();
                BattleMode.UI.splashText.SetText(s);
            }

            if (AnimationFrame >= 415)
            {
                AnimationFrame = 0;
                s = "";
                BattleMode.moveEnd = false;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
        public override bool PerformInWorld(Projectile proj, ParentPokemon mon, Vector2 pos, TerramonPlayer player)
        {
            NPC target = GetNearestNPC(pos);

            if (target == null)
            {
                return(false);
            }
            player.Attacking = true;
            Vector2 vel = (target.position + (target.Size / 2)) - (proj.position + (proj.Size / 2));
            var     l   = vel.Length();

            vel += target.velocity * (l / 100); //Make predict shoot
            vel.Normalize();                    //Direction
            vel *= 15;                          //Speed
            Projectile.NewProjectile((proj.position + (proj.Size / 2)), vel, ProjectileID.DD2PhoenixBowShot, 20, 1f, player.whoAmI);
            return(true);
        }
Beispiel #21
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                AnimationFrame     = 0;
                BattleMode.moveEnd = false;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
 public override bool OverrideAI(Projectile proj, ParentPokemon mon, TerramonPlayer player)
 {
     if (!moveDone)
     {
         NPC target = GetNearestNPC(proj.position);
         if (target == null)
         {
             moveDone = true;
         }
         proj.velocity = proj.position - target.position; //gets a line and direction to the enemy
         proj.velocity.Normalize();                       //sets it to something between 0 and 1
         proj.velocity *= 7f;                             //multiplies that angle by 7
         if (proj.Distance(target.Center) <= 10f)
         {
             target.StrikeNPC(32, 6f, proj.direction);
             moveDone = true;
         }
     }
     return(!moveDone);       //return the opposite of moveDone so that when moveDone goes true it goes back to normal AI
 }
Beispiel #23
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            // Finished all hits
            if (displayHitCountAndEnd)
            {
                hitCountTimer++;
                if (hitCountTimer == 55)
                {
                    BattleMode.UI.splashText.SetText($"Hit {hits} time(s)!");
                    BattleMode.queueEndMove = true;
                }
            }

            if (!displayHitCountAndEnd)
            {
                if (AnimationFrame == 1) //At initial frame we pan camera to attacker
                {
                    TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                    TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);

                    // Decide total amounts to hit
                    hits = GetHits();
                }
                else if (AnimationFrame == 140)
                {
                    BattleMode.UI.splashText.SetText("");

                    TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                    TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);
                }
                else if (AnimationFrame == 154)
                {
                    MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                }
                else if (AnimationFrame == 155)
                {
                    kchop = Projectile.NewProjectile(target.projectile.Center + new Vector2(-90, 0), new Vector2(12, 0), ModContent.ProjectileType <Hand>(), 0, 0);
                }
                else if (AnimationFrame == 170)
                {
                    Main.projectile[kchop].velocity = new Vector2(-12, 0);
                    Vector2 stored = target.projectile.position;

                    for (int i = 0; i < 16; i++)
                    {
                        Dust.NewDust(stored, target.projectile.width, target.projectile.height,
                                     ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"), 0, 0, 0, Color.White);
                    }
                }
                else if (AnimationFrame == 188)
                {
                    Vector2 stored = target.projectile.position;

                    for (int i = 0; i < 16; i++)
                    {
                        Dust.NewDust(stored, target.projectile.width, target.projectile.height,
                                     ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"), 0, 0, 0, Color.White);
                    }
                }
                else if (AnimationFrame == 190)
                {
                    Main.projectile[kchop].timeLeft = 0;
                    Main.projectile[kchop].active   = false;
                    InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                    if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                    {
                        CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                    }
                    //BattleMode.queueEndMove = true;
                }

                // SECOND HIT, GUARENTEED

                if (AnimationFrame == 250)
                {
                    MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                    kchop     = Projectile.NewProjectile(target.projectile.Center + new Vector2(-90, 0), new Vector2(12, 0), ModContent.ProjectileType <Hand>(), 0, 0);
                }
                else if (AnimationFrame == 265)
                {
                    Main.projectile[kchop].velocity = new Vector2(-12, 0);
                    Vector2 stored = target.projectile.position;

                    for (int i = 0; i < 16; i++)
                    {
                        Dust.NewDust(stored, target.projectile.width, target.projectile.height,
                                     ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"), 0, 0, 0, Color.White);
                    }
                }
                else if (AnimationFrame == 283)
                {
                    Vector2 stored = target.projectile.position;

                    for (int i = 0; i < 16; i++)
                    {
                        Dust.NewDust(stored, target.projectile.width, target.projectile.height,
                                     ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"), 0, 0, 0, Color.White);
                    }
                }
                else if (AnimationFrame == 285)
                {
                    Main.projectile[kchop].timeLeft = 0;
                    Main.projectile[kchop].active   = false;
                    InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                    if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                    {
                        CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                    }
                    if (hits == 2 || deffender.HP == 0)
                    {
                        displayHitCountAndEnd = true;
                    }
                }

                // THIRD HIT, NOT GUARENTEED

                if (AnimationFrame == 345)
                {
                    MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                    kchop     = Projectile.NewProjectile(target.projectile.Center + new Vector2(-90, 0), new Vector2(12, 0), ModContent.ProjectileType <Hand>(), 0, 0);
                }
                else if (AnimationFrame == 360)
                {
                    Main.projectile[kchop].velocity = new Vector2(-12, 0);
                    Vector2 stored = target.projectile.position;

                    for (int i = 0; i < 16; i++)
                    {
                        Dust.NewDust(stored, target.projectile.width, target.projectile.height,
                                     ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"), 0, 0, 0, Color.White);
                    }
                }
                else if (AnimationFrame == 378)
                {
                    Vector2 stored = target.projectile.position;

                    for (int i = 0; i < 16; i++)
                    {
                        Dust.NewDust(stored, target.projectile.width, target.projectile.height,
                                     ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"), 0, 0, 0, Color.White);
                    }
                }
                else if (AnimationFrame == 380)
                {
                    Main.projectile[kchop].timeLeft = 0;
                    Main.projectile[kchop].active   = false;
                    InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                    if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                    {
                        CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                    }
                    if (hits == 3 || deffender.HP == 0)
                    {
                        displayHitCountAndEnd = true;
                    }
                }

                // FOURTH HIT, NOT GUARENTEED

                if (AnimationFrame == 440)
                {
                    MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                    kchop     = Projectile.NewProjectile(target.projectile.Center + new Vector2(-90, 0), new Vector2(12, 0), ModContent.ProjectileType <Hand>(), 0, 0);
                }
                else if (AnimationFrame == 455)
                {
                    Main.projectile[kchop].velocity = new Vector2(-12, 0);
                    Vector2 stored = target.projectile.position;

                    for (int i = 0; i < 16; i++)
                    {
                        Dust.NewDust(stored, target.projectile.width, target.projectile.height,
                                     ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"), 0, 0, 0, Color.White);
                    }
                }
                else if (AnimationFrame == 473)
                {
                    Vector2 stored = target.projectile.position;

                    for (int i = 0; i < 16; i++)
                    {
                        Dust.NewDust(stored, target.projectile.width, target.projectile.height,
                                     ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"), 0, 0, 0, Color.White);
                    }
                }
                else if (AnimationFrame == 475)
                {
                    Main.projectile[kchop].timeLeft = 0;
                    Main.projectile[kchop].active   = false;
                    InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                    if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                    {
                        CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                    }
                    if (hits == 4 || deffender.HP == 0)
                    {
                        displayHitCountAndEnd = true;
                    }
                }

                // FIFTH HIT, NOT GUARENTEED

                if (AnimationFrame == 535)
                {
                    MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                    kchop     = Projectile.NewProjectile(target.projectile.Center + new Vector2(-90, 0), new Vector2(12, 0), ModContent.ProjectileType <Hand>(), 0, 0);
                }
                else if (AnimationFrame == 550)
                {
                    Main.projectile[kchop].velocity = new Vector2(-12, 0);
                    Vector2 stored = target.projectile.position;

                    for (int i = 0; i < 16; i++)
                    {
                        Dust.NewDust(stored, target.projectile.width, target.projectile.height,
                                     ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"), 0, 0, 0, Color.White);
                    }
                }
                else if (AnimationFrame == 568)
                {
                    Vector2 stored = target.projectile.position;

                    for (int i = 0; i < 16; i++)
                    {
                        Dust.NewDust(stored, target.projectile.width, target.projectile.height,
                                     ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"), 0, 0, 0, Color.White);
                    }
                }
                else if (AnimationFrame == 570)
                {
                    Main.projectile[kchop].timeLeft = 0;
                    Main.projectile[kchop].active   = false;
                    InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                    if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                    {
                        CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                    }
                    if (hits == 5 || deffender.HP == 0)
                    {
                        displayHitCountAndEnd = true;
                    }
                }
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                AnimationFrame        = 0;
                hits                  = 0;
                hitCountTimer         = 0;
                displayHitCountAndEnd = false;
                BattleMode.moveEnd    = false;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
Beispiel #24
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1) //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140)
            {
                BattleMode.UI.splashText.SetText("");

                mon.useAi = false;
                mon.projectile.tileCollide = false;

                oldCenter = mon.projectile.Center;

                someCenterPoint = mon.projectile.Center + new Vector2(0, -20);

                for (int i = 0; i < 10; i++)
                {
                    Dust.NewDust(mon.projectile.Center, mon.projectile.width, mon.projectile.height,
                                 ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"));
                }

                MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
            }
            else if (AnimationFrame == 170)
            {
                for (int i = 0; i < 10; i++)
                {
                    Dust.NewDust(oldCenter, mon.projectile.width, mon.projectile.height,
                                 ModContent.GetInstance <TerramonMod>().DustType("SmokeTransformDust"));
                }

                mon.projectile.Center = oldCenter;

                if (mon.projectile.spriteDirection == -1)
                {
                    adder = 10;
                }
                else
                {
                    adder = -10;
                }

                xposStart  = (int)mon.projectile.position.X;
                xposTarget = (int)mon.projectile.position.X + adder;
            }
            else if (AnimationFrame == 235)
            {
                string s = ModifyStat(attacker, mon, GetStat.Speed, 2, state, !opponent).ToString();
                BattleMode.UI.splashText.SetText(s);
            }
            else if (AnimationFrame >= 385)
            {
                mon.useAi = true;
                mon.projectile.tileCollide = true;
                AnimationFrame             = 0;
                someCenterPoint            = Vector2.Zero;
                oldCenter          = Vector2.Zero;
                rotTimer           = 0;
                xposStart          = 0;
                xposTarget         = 0;
                adder              = 0;
                AnimationFrame     = 0;
                BattleMode.moveEnd = false;
                return(false);
            }
            else if (AnimationFrame > 170 && AnimationFrame < 177)
            {
                mon.projectile.position.X = Interpolation.ValueAt(AnimationFrame, xposStart, xposTarget, 170, 176,
                                                                  Easing.None);
            }
            else if (AnimationFrame > 176 && AnimationFrame < 185)
            {
                mon.projectile.position.X = Interpolation.ValueAt(AnimationFrame, xposTarget, xposStart - adder, 176, 184,
                                                                  Easing.None);
            }
            else if (AnimationFrame > 184 && AnimationFrame < 191)
            {
                mon.projectile.position.X = Interpolation.ValueAt(AnimationFrame, xposStart - adder, xposStart, 184, 190,
                                                                  Easing.None);
            }

            if (AnimationFrame > 140 && AnimationFrame < 170)
            {
                rotTimer += MathHelper.Pi * 6f / 30;

                mon.projectile.Center = someCenterPoint + Vector2.One.RotatedBy(rotTimer) * 6.3f;
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
Beispiel #25
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            // Finished all hits
            if (displayHitCountAndEnd)
            {
                hitCountTimer++;
                if (hitCountTimer == 55)
                {
                    BattleMode.UI.splashText.SetText($"Hit {hits} time(s)!");
                    BattleMode.queueEndMove = true;
                }
            }

            if (!displayHitCountAndEnd)
            {
                if (AnimationFrame == 1) //At initial frame we pan camera to attacker
                {
                    TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                    TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);

                    // Decide total amounts to hit
                    hits = GetHits();
                }
                else if (AnimationFrame == 140)
                {
                    BattleMode.UI.splashText.SetText("");

                    TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                    TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);
                }
                else if (AnimationFrame == 154)
                {
                    MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                }
                else if (AnimationFrame == 155)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 160)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 165)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 170)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 175)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 210)
                {
                    InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                    if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                    {
                        CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                    }
                }

                // SECOND HIT, GUARENTEED

                //if (AnimationFrame == 269) MoveSound = Main.PlaySound(ModContent.GetInstance<TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                else if (AnimationFrame == 270)
                {
                    MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                }
                else if (AnimationFrame == 275)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 280)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 285)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 290)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 295)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 330)
                {
                    InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                    if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                    {
                        CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                    }
                    if (hits == 2 || deffender.HP == 0)
                    {
                        displayHitCountAndEnd = true;
                    }
                }

                // THIRD HIT, NOT GUARENTEED

                //if (AnimationFrame == 389) MoveSound = Main.PlaySound(ModContent.GetInstance<TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                else if (AnimationFrame == 390)
                {
                    MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                }
                else if (AnimationFrame == 395)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 400)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 405)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 410)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 415)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 450)
                {
                    InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                    if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                    {
                        CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                    }
                    if (hits == 3 || deffender.HP == 0)
                    {
                        displayHitCountAndEnd = true;
                    }
                }

                // FOURTH HIT, NOT GUARENTEED

                //if (AnimationFrame == 509) MoveSound = Main.PlaySound(ModContent.GetInstance<TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                else if (AnimationFrame == 510)
                {
                    MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                }
                else if (AnimationFrame == 515)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 520)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 525)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 530)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 535)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 570)
                {
                    InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                    if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                    {
                        CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                    }
                    if (hits == 4 || deffender.HP == 0)
                    {
                        displayHitCountAndEnd = true;
                    }
                }

                // FIFTH HIT, NOT GUARENTEED

                //if (AnimationFrame == 629) MoveSound = Main.PlaySound(ModContent.GetInstance<TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                else if (AnimationFrame == 630)
                {
                    MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));
                }
                else if (AnimationFrame == 635)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 640)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 645)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 650)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 655)
                {
                    Projectile.NewProjectile(target.projectile.Center + new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18)), Vector2.Zero, ModContent.ProjectileType <CometPunchFist>(), 0, 0);
                }
                else if (AnimationFrame == 690)
                {
                    InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                    if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                    {
                        CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                    }
                    if (hits == 5 || deffender.HP == 0)
                    {
                        displayHitCountAndEnd = true;
                    }
                }
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                AnimationFrame        = 0;
                hits                  = 0;
                hitCountTimer         = 0;
                displayHitCountAndEnd = false;
                BattleMode.moveEnd    = false;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
Beispiel #26
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1) //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140) //Move animation begin after 140 frames
            {
                BattleMode.UI.splashText.SetText("");

                MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));

                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.Center.X, 300, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.Center.Y - 60, 300, Easing.OutExpo);

                acidBubble = Projectile.NewProjectile(mon.projectile.Center + new Vector2(0, -60), new Vector2(0, 0), ModContent.ProjectileType <AcidBubble>(), 0, 0);
                Main.projectile[acidBubble].maxPenetrate = 99;
                Main.projectile[acidBubble].penetrate    = 99;
            }
            else if (AnimationFrame == 170)
            {
                acidBubble1 = Projectile.NewProjectile(Main.projectile[acidBubble].position, new Vector2(0, 0), ModContent.ProjectileType <AcidBubble>(), 0, 0);
                Main.projectile[acidBubble1].alpha        = 0;
                Main.projectile[acidBubble1].maxPenetrate = 99;
                Main.projectile[acidBubble1].penetrate    = 99;
                Main.projectile[acidBubble].timeLeft      = 0;
            }
            else if (AnimationFrame == 300)//At Last frame we destroy new proj
            {
                InflictDamage(mon, target, player, attacker, deffender, state, opponent);

                // create some particles

                for (int i = 0; i < 50; i++)
                {
                    Dust dust1 = Dust.NewDustDirect(target.projectile.position, target.projectile.width, target.projectile.height, 86, 0f, 0f, 0);
                    dust1.alpha     = 0;
                    dust1.noGravity = true;
                }

                var id = acidBubble1;
                if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                {
                    CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                }
                Main.projectile[id].timeLeft = 0;
                Main.projectile[id].active   = false;
                BattleMode.queueEndMove      = true;
            }

            if (AnimationFrame > 170 && AnimationFrame < 301)
            {
                Main.projectile[acidBubble1].position = Interpolation.ValueAt(AnimationFrame, mon.projectile.Center + new Vector2(0, -60), target.projectile.position, 170, 300,
                                                                              Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosX(Main.projectile[acidBubble1].position.X, 1, Easing.None);
                TerramonMod.ZoomAnimator.ScreenPosY(Main.projectile[acidBubble1].position.Y, 1, Easing.None);
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                endMoveTimer++;

                // Acid deals damage and has a 10% chance of lowering the target's Special Defense by one stage.
                if (endMoveTimer == 1 && Main.rand.NextFloat() > .1323f)
                {
                    endMoveTimer       = 0;
                    AnimationFrame     = 0;
                    BattleMode.moveEnd = false;
                    return(false);
                }

                if (endMoveTimer == 50)
                {
                    s = ModifyStat(deffender, target, GetStat.SpDef, -1, state, opponent).ToString();
                    if (s.Contains("won't go"))
                    {
                        endMoveTimer = 190;
                    }

                    TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                    TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);
                }
                if (endMoveTimer == 190)
                {
                    BattleMode.UI.splashText.SetText(s);
                }
                if (endMoveTimer >= 330)
                {
                    endMoveTimer       = 0;
                    AnimationFrame     = 0;
                    BattleMode.moveEnd = false;
                    return(false);
                }
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
Beispiel #27
0
 public virtual bool PerformInWorld(ParentPokemon mon, NPC target) => false;
Beispiel #28
0
 public virtual bool PerformInBattle(ParentPokemon mon, ParentPokemon target) => false;
Beispiel #29
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1) //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140) //Move animation begin after 140 frames
            {
                BattleMode.UI.splashText.SetText("");

                MoveSound = Main.PlaySound(ModContent.GetInstance <TerramonMod>().GetLegacySoundSlot(SoundType.Custom, "Sounds/UI/BattleSFX/" + MoveName).WithVolume(.75f));

                TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);

                a      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore1 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + a, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore1].maxPenetrate = 99;
                Main.projectile[spore1].penetrate    = 99;
            }
            else if (AnimationFrame == 155)
            {
                b      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore2 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + b, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore2].maxPenetrate = 99;
                Main.projectile[spore2].penetrate    = 99;
            }
            else if (AnimationFrame == 170)
            {
                c      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore3 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + c, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore3].maxPenetrate = 99;
                Main.projectile[spore3].penetrate    = 99;
            }
            else if (AnimationFrame == 185)
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
                d      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore4 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + d, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore4].maxPenetrate = 99;
                Main.projectile[spore4].penetrate    = 99;
            }
            else if (AnimationFrame == 200)
            {
                e      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore5 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + e, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore5].maxPenetrate = 99;
                Main.projectile[spore5].penetrate    = 99;
            }
            else if (AnimationFrame == 215)
            {
                f      = new Vector2(Main.rand.Next(-18, 18), Main.rand.Next(-18, 18));
                spore6 = Projectile.NewProjectile(target.projectile.Hitbox.Center() + f, new Vector2(0, 0), ModContent.ProjectileType <AbsorbSpore>(), 0, 0);
                Main.projectile[spore6].maxPenetrate = 99;
                Main.projectile[spore6].penetrate    = 99;
            }
            else if (AnimationFrame == 265)//At Last frame we destroy new proj
            {
                TerramonMod.ZoomAnimator.ScreenPosX(target.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(target.projectile.position.Y, 500, Easing.OutExpo);
                damageDealt = InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                {
                    CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                }
                Main.projectile[spore1].timeLeft = 0;
                Main.projectile[spore1].active   = false;
                Main.projectile[spore2].timeLeft = 0;
                Main.projectile[spore2].active   = false;
                Main.projectile[spore3].timeLeft = 0;
                Main.projectile[spore3].active   = false;
                Main.projectile[spore4].timeLeft = 0;
                Main.projectile[spore4].active   = false;
                Main.projectile[spore5].timeLeft = 0;
                Main.projectile[spore5].active   = false;
                Main.projectile[spore6].timeLeft = 0;
                Main.projectile[spore6].active   = false;
                BattleMode.queueEndMove          = true;
            }

            else if (AnimationFrame > 140 && AnimationFrame < 265)
            {
                //Vector2 vel = (target.projectile.position + (target.projectile.Size / 2)) - (mon.projectile.position + (mon.projectile.Size / 2));
                //var l = vel.Length();
                //vel.Normalize();
                //Main.projectile[id].position = mon.projectile.position + (vel * (l * (AnimationFrame / 120)));
                if (AnimationFrame < 190)
                {
                    var pos = Main.projectile[spore1].position;
                    Main.projectile[spore1].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + a, mon.projectile.Hitbox.Center(), 140, 190,
                                                                             Easing.Out);
                    AbsorbSpore ai = (AbsorbSpore)Main.projectile[spore1].modProjectile;
                    ai.vel = Main.projectile[spore1].position - pos;
                }
                if (AnimationFrame > 155 && AnimationFrame < 205)
                {
                    var pos = Main.projectile[spore2].position;
                    Main.projectile[spore2].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + b, mon.projectile.Hitbox.Center(), 155, 205,
                                                                             Easing.Out);
                    AbsorbSpore bi = (AbsorbSpore)Main.projectile[spore2].modProjectile;
                    bi.vel = Main.projectile[spore2].position - pos;
                }
                if (AnimationFrame > 170 && AnimationFrame < 220)
                {
                    var pos = Main.projectile[spore3].position;
                    Main.projectile[spore3].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + c, mon.projectile.Hitbox.Center(), 170, 220,
                                                                             Easing.Out);
                    AbsorbSpore ci = (AbsorbSpore)Main.projectile[spore3].modProjectile;
                    ci.vel = Main.projectile[spore3].position - pos;
                }
                if (AnimationFrame > 185 && AnimationFrame < 235)
                {
                    var pos = Main.projectile[spore4].position;
                    Main.projectile[spore4].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + d, mon.projectile.Hitbox.Center(), 185, 235,
                                                                             Easing.Out);
                    AbsorbSpore di = (AbsorbSpore)Main.projectile[spore4].modProjectile;
                    di.vel = Main.projectile[spore4].position - pos;
                }
                if (AnimationFrame > 200 && AnimationFrame < 250)
                {
                    var pos = Main.projectile[spore5].position;
                    Main.projectile[spore5].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + e, mon.projectile.Hitbox.Center(), 200, 250,
                                                                             Easing.Out);
                    AbsorbSpore ei = (AbsorbSpore)Main.projectile[spore5].modProjectile;
                    ei.vel = Main.projectile[spore5].position - pos;
                }
                if (AnimationFrame > 215 && AnimationFrame < 265)
                {
                    var pos = Main.projectile[spore6].position;
                    Main.projectile[spore6].position = Interpolation.ValueAt(AnimationFrame, target.projectile.Hitbox.Center() + f, mon.projectile.Hitbox.Center(), 215, 265,
                                                                             Easing.Out);
                    AbsorbSpore fi = (AbsorbSpore)Main.projectile[spore6].modProjectile;
                    fi.vel = Main.projectile[spore6].position - pos;
                }
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                endMoveTimer++;
                if (endMoveTimer >= 50 && endMoveTimer < 190)
                {
                    if (opponent)
                    {
                        BattleMode.UI.splashText.SetText($"{deffender.PokemonName} had its energy drained!");
                    }
                    else
                    {
                        if (state == BattleState.BattleWithWild)
                        {
                            BattleMode.UI.splashText.SetText($"The wild {deffender.PokemonName} had its energy drained!");
                        }
                        else
                        if (state == BattleState.BattleWithTrainer)
                        {
                            BattleMode.UI.splashText.SetText($"The foe's {deffender.PokemonName} had its energy drained!");
                        }
                    }
                    //TerramonMod.ZoomAnimator.ScreenPos(mon.projectile.position + new Vector2(12, 0), 500, Easing.OutExpo);
                    TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                    TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
                    //BattleMode.animWindow = 0;
                }
                if (endMoveTimer == 190)
                {
                    BattleMode.UI.splashText.SetText("");
                    // If this attack deals 1 HP of damage, 1 HP will be restored to the user.
                    if ((int)damageDealt == 1)
                    {
                        CombatText.NewText(mon.projectile.Hitbox, CombatText.HealLife, SelfHeal(attacker, mon, 1));
                    }
                    else
                    {
                        CombatText.NewText(mon.projectile.Hitbox, CombatText.HealLife, SelfHeal(attacker, mon, (int)damageDealt / 2));
                    }
                }
                if (endMoveTimer >= 330)
                {
                    endMoveTimer       = 0;
                    AnimationFrame     = 0;
                    BattleMode.moveEnd = false;
                    return(false);
                }
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }
Beispiel #30
0
        public override bool AnimateTurn(ParentPokemon mon, ParentPokemon target, TerramonPlayer player, PokemonData attacker,
                                         PokemonData deffender, BattleState state, bool opponent)
        {
            if (AnimationFrame == 1) //At initial frame we pan camera to attacker
            {
                TerramonMod.ZoomAnimator.ScreenPosX(mon.projectile.position.X + 12, 500, Easing.OutExpo);
                TerramonMod.ZoomAnimator.ScreenPosY(mon.projectile.position.Y, 500, Easing.OutExpo);
            }
            else if (AnimationFrame == 140) //Move animation begin after 140 frames
            {
                BattleMode.UI.splashText.SetText("");

                Vector2 vel = (target.projectile.position + (target.projectile.Size / 2)) - (mon.projectile.position + (mon.projectile.Size / 2));
                vel.Normalize();
                vel *= 15;
                int id = Projectile.NewProjectile(mon.projectile.position, vel,
                                                  ProjectileID.DD2PhoenixBowShot, 0, 0);
                Main.projectile[id].maxPenetrate = 99;
                Main.projectile[id].penetrate    = 99;
                Main.projectile[id].tileCollide  = false;

                if (attacker.CustomData.ContainsKey(PROJID_KEY))
                {
                    attacker.CustomData[PROJID_KEY] = id.ToString();
                }
                else
                {
                    attacker.CustomData.Add(PROJID_KEY, id.ToString());
                }
            }
            else if (AnimationFrame == 260)//At Last frame we destroy new proj
            {
                InflictDamage(mon, target, player, attacker, deffender, state, opponent);
                var id = int.Parse(attacker.CustomData[PROJID_KEY]);
                if (PostTextLoc.Args.Length >= 4)                                                                      //If we can extract damage number
                {
                    CombatText.NewText(target.projectile.Hitbox, CombatText.DamagedHostile, (int)PostTextLoc.Args[3]); //Print combat text at attacked mon position
                }
                Main.projectile[id].timeLeft = 0;
                Main.projectile[id].active   = false;
                BattleMode.queueEndMove      = true;
            }
            else if (AnimationFrame > 140 && AnimationFrame < 261)
            {
                var id = int.Parse(attacker.CustomData[PROJID_KEY]);
                //Vector2 vel = (target.projectile.position + (target.projectile.Size / 2)) - (mon.projectile.position + (mon.projectile.Size / 2));
                //var l = vel.Length();
                //vel.Normalize();
                //Main.projectile[id].position = mon.projectile.position + (vel * (l * (AnimationFrame / 120)));
                Main.projectile[id].position = Interpolation.ValueAt(AnimationFrame, mon.projectile.position, target.projectile.position, 140, 260,
                                                                     Easing.Out);
                TerramonMod.ZoomAnimator.ScreenPosX(Main.projectile[id].position.X, 1, Easing.None);
                TerramonMod.ZoomAnimator.ScreenPosY(Main.projectile[id].position.Y, 1, Easing.None);
            }

            // This should be at the very bottom of AnimateTurn() in every move.
            if (BattleMode.moveEnd)
            {
                AnimationFrame     = 0;
                BattleMode.moveEnd = false;
                return(false);
            }

            // IGNORE EVERYTHING BELOW WHEN MAKING YOUR OWN MOVES.
            if (AnimationFrame > 1810)
            {
                return(false);
            }

            return(true);
        }