Exemple #1
0
        public override void OnCast()
        {
            AbilityHandler mp = player.GetModPlayer <AbilityHandler>();

            Active = true;
            Timer  = mp.StatStamina * 60 + (int)((1 - mp.StatStaminaRegen / (float)mp.StatStaminaRegenMax) * 60) - 1; //allows the use of fractional stamina

            //Sets the player's stamina if full to prevent spamming the ability to abuse it and to draw the UI correctly.
            if (mp.StatStamina == mp.StatStaminaMax)
            {
                mp.StatStamina--;
                mp.StatStaminaRegen = 1;
            }

            for (int k = 0; k <= 50; k++)
            {
                Dust.NewDust(player.Center - new Vector2(player.height / 2, player.height / 2), player.height, player.height, DustType <Gold2>(), Main.rand.Next(-20, 20), Main.rand.Next(-20, 20), 0, Color.Red, 1.2f);
            }
        }
Exemple #2
0
        public virtual void StartAbility(Player player)
        {
            AbilityHandler handler = player.GetModPlayer <AbilityHandler>();
            DragonHandler  dragon  = player.GetModPlayer <DragonHandler>();

            //if the player: has enough stamina  && unlocked && not on CD     && Has no other abilities active
            if (CanUse && handler.StatStamina >= StaminaCost && !Locked && Cooldown == 0 && !handler.Abilities.Any(a => a.Active))
            {
                handler.StatStamina -= StaminaCost; //Consume the stamina
                                                    //if (dragon.DragonMounted) OnCastDragon(); //Do what the ability should do when it starts
                                                    /*else*/
                OnCast();
                Active = true;                      //Ability is activated

                if (Main.netMode == NetmodeID.MultiplayerClient)
                {
                    SendPacket();
                }
            }
        }
        public virtual void StartAbility(Player player)
        {
            AbilityHandler handler = player.GetModPlayer <AbilityHandler>();
            DragonHandler  dragon  = player.GetModPlayer <DragonHandler>();

            //if the player: has enough stamina  && unlocked && not on CD     && Has no other abilities active
            if (CanUse && handler.StatStamina >= StaminaCost && !Locked && Cooldown == 0 && !handler.Abilities.Any(a => a.Active))
            {
                handler.StatStamina -= StaminaCost; //Consume the stamina
                if (dragon.DragonMounted)
                {
                    OnCastDragon();                       //Do what the ability should do when it starts
                }
                else
                {
                    OnCast();
                }
                Active = true; //Ability is activated
            }
        }
Exemple #4
0
        public override void InUse()
        {
            AbilityHandler mp = player.GetModPlayer <AbilityHandler>();

            Timer--;
            player.maxFallSpeed = 999;
            player.gravity      = 0;
            player.velocity     = Vector2.Normalize(new Vector2
                                                    (
                                                        Main.screenPosition.X + Main.mouseX - player.Hitbox.Center.X,
                                                        Main.screenPosition.Y + Main.mouseY - player.Hitbox.Center.Y
                                                    )) * 5 + new Vector2(0.25f, 0.25f);

            player.Hitbox = new Rectangle(player.Hitbox.X - 7 + 7, player.Hitbox.Y + 21 + 7, 14, 14);

            Lighting.AddLight(player.Center, new Vector3(0.15f, 0.15f, 0f));

            if (Timer % 60 == 0 && Timer > 0)
            {
                mp.StatStamina--;
            }
            else if (Timer > 0)
            {
                mp.StatStaminaRegen = (int)((1 - (Timer + 60) % 60 / 60f) * mp.StatStaminaRegenMax);
            }
            else
            {
                mp.StatStaminaRegen = mp.StatStaminaRegenMax;
            }

            if (StarlightRiver.Wisp.JustReleased)
            {
                exit = true;
            }

            if (exit || (mp.StatStamina < 1 && mp.StatStaminaRegen == mp.StatStaminaRegenMax))
            {
                OnExit();
            }
        }
Exemple #5
0
 public void Activate(AbilityHandler user)
 {
     user.ActiveAbility = this;
 }
Exemple #6
0
 public float ActivationCost(AbilityHandler handler) => (ActivationCostDefault + ActivationCostBonus) * handler.StaminaCostMultiplier + handler.StaminaCostBonus;
Exemple #7
0
        public override void clientClone(ModPlayer clientClone)
        {
            AbilityHandler clone = clientClone as AbilityHandler;

            clone.ability = ability;
        }