예제 #1
0
        public void HandleFiring(Player player, Vector2 mouseVector)
        {
            MyPlayer modPlayer = player.GetModPlayer <MyPlayer>();

            // minimum charge level is required to fire in the first place, but once you fire, you can keep firing.
            if (ShouldFireBeam(modPlayer))
            {
                // kill the charge sound if we're firing
                ChargeSoundSlotId = SoundUtil.KillTrackedSound(ChargeSoundSlotId);

                if (!WasSustainingFire && MyProjectile == null)
                {
                    if (Main.netMode != NetmodeID.MultiplayerClient || Main.myPlayer == player.whoAmI)
                    {
                        // fire the laser!
                        MyProjectile = Projectile.NewProjectileDirect(projectile.position + BeamCreationOffset, projectile.velocity, mod.ProjectileType(BeamProjectileName), GetBeamDamage(), projectile.knockBack, projectile.owner);

                        // set firing time minimum for beams that auto-detach and are stationary, this prevents their self kill routine
                        MyProjectile.ai[1] = MinimumFireFrames;
                    }
                }

                // increment the fire time, this handles "IsSustainingFire" as well as stating the beam is no longer firable (it is already being fired)
                CurrentFireTime++;

                // if the player has charge left, drain the ball
                if (ChargeLevel >= FireDecayRate())
                {
                    ChargeLevel = Math.Max(0f, ChargeLevel - FireDecayRate());
                }
                else if (!modPlayer.IsKiDepleted())
                {
                    if (DBZMOD.IsTickRateElapsed(FIRE_KI_DRAIN_WINDOW))
                    {
                        modPlayer.AddKi(-FireKiDrainRate(), true, false);
                    }
                }
                else
                {
                    // beam is no longer sustainable
                    KillBeam();
                }
            }
            else
            {
                // player has stopped firing or something else has stopped them
                KillBeam();
            }

            WasSustainingFire = IsSustainingFire;
        }
예제 #2
0
        /*public override void SetDefaults(NPC npc)
         * {
         *  Mod thoriummod = ModLoader.GetMod("ThoriumMod");
         *  Mod calamitymod = ModLoader.GetMod("CalamityMod");
         *
         *  if (MyPlayer.RealismMode)
         *  {
         *      if (npc.type == NPCID.EyeofCthulhu)
         *      {
         *          npc.lifeMax = npc.lifeMax * 2;
         *      }
         *      else if (npc.type == NPCID.EaterofWorldsHead)
         *      {
         *          npc.lifeMax = npc.lifeMax * 3;
         *      }
         *      else if (npc.type == NPCID.EaterofWorldsBody)
         *      {
         *          npc.lifeMax = npc.lifeMax * 3;
         *      }
         *      else if (npc.type == NPCID.EaterofWorldsTail)
         *      {
         *          npc.lifeMax = npc.lifeMax * 3;
         *      }
         *      else if (npc.type == NPCID.BrainofCthulhu)
         *      {
         *          npc.lifeMax = npc.lifeMax * 3;
         *      }
         *      else if (npc.type == NPCID.QueenBee)
         *      {
         *          npc.lifeMax = npc.lifeMax * 4;
         *      }
         *      else if (npc.type == NPCID.SkeletronHead)
         *      {
         *          npc.lifeMax = npc.lifeMax * 5;
         *      }
         *      else if (npc.type == NPCID.SkeletronHand)
         *      {
         *          npc.lifeMax = npc.lifeMax * 5;
         *      }
         *      else if (npc.type == NPCID.WallofFlesh)
         *      {
         *          npc.lifeMax = npc.lifeMax * 7;
         *      }
         *      else if (npc.type == NPCID.WallofFleshEye)
         *      {
         *          npc.lifeMax = npc.lifeMax * 7;
         *      }
         *      else if (npc.type == NPCID.Spazmatism)
         *      {
         *          npc.lifeMax = npc.lifeMax * 8;
         *      }
         *      else if (npc.type == NPCID.Retinazer)
         *      {
         *          npc.lifeMax = npc.lifeMax * 8;
         *      }
         *      else if (npc.type == NPCID.SkeletronPrime)
         *      {
         *          npc.lifeMax = npc.lifeMax * 8;
         *      }
         *      else if (npc.type == NPCID.TheDestroyer)
         *      {
         *          npc.lifeMax = npc.lifeMax * 8;
         *      }
         *      else if (npc.type == NPCID.Plantera)
         *      {
         *          npc.lifeMax = npc.lifeMax * 9;
         *      }
         *      else if (npc.type == NPCID.Golem)
         *      {
         *          npc.lifeMax = npc.lifeMax * 9;
         *      }
         *      else if (npc.type == NPCID.GolemHead)
         *      {
         *          npc.lifeMax = npc.lifeMax * 9;
         *      }
         *      else if (npc.type == NPCID.GolemFistLeft)
         *      {
         *          npc.lifeMax = npc.lifeMax * 9;
         *      }
         *      else if (npc.type == NPCID.GolemFistRight)
         *      {
         *          npc.lifeMax = npc.lifeMax * 9;
         *      }
         *      else if (npc.type == NPCID.DukeFishron)
         *      {
         *          npc.lifeMax = npc.lifeMax * 10;
         *      }
         *      else if (npc.type == NPCID.CultistBoss)
         *      {
         *          npc.lifeMax = npc.lifeMax * 11;
         *      }
         *      else if (npc.type == NPCID.MoonLordCore)
         *      {
         *          npc.lifeMax = npc.lifeMax * 12;
         *      }
         *      else if (npc.type == NPCID.MoonLordHand)
         *      {
         *          npc.lifeMax = npc.lifeMax * 12;
         *      }
         *      else if (npc.type == NPCID.MoonLordHead)
         *      {
         *          npc.lifeMax = npc.lifeMax * 12;
         *      }
         *      else if (npc.type == thoriummod.NPCType("TheGrandThunderBirdv2"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 2;
         *      }
         *      else if (npc.type == thoriummod.NPCType("QueenJelly"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 3;
         *      }
         *      else if (npc.type == thoriummod.NPCType("Viscount"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 4;
         *      }
         *      else if (npc.type == thoriummod.NPCType("TheBuriedWarrior"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 5;
         *      }
         *      else if (npc.type == thoriummod.NPCType("GraniteEnergyStorm"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 5;
         *      }
         *      else if (npc.type == thoriummod.NPCType("ThePrimeScouter"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 6;
         *      }
         *      else if (npc.type == thoriummod.NPCType("BoreanStrider"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 7;
         *      }
         *      else if (npc.type == thoriummod.NPCType("BoreanStriderPopped"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 7;
         *      }
         *      else if (npc.type == thoriummod.NPCType("FallenDeathBeholder"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 7;
         *      }
         *      else if (npc.type == thoriummod.NPCType("FallenDeathBeholder2"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 7;
         *      }
         *      else if (npc.type == thoriummod.NPCType("Lich"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 8;
         *      }
         *      else if (npc.type == thoriummod.NPCType("LichHeadless"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 8;
         *      }
         *      else if (npc.type == thoriummod.NPCType("Abyssion"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 9;
         *      }
         *      else if (npc.type == thoriummod.NPCType("AbyssionCracked"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 9;
         *      }
         *      else if (npc.type == thoriummod.NPCType("AbyssionReleased"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 9;
         *      }
         *      else if (npc.type == thoriummod.NPCType("Aquaius"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 13;
         *      }
         *      else if (npc.type == thoriummod.NPCType("Aquaius2"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 13;
         *      }
         *      else if (npc.type == thoriummod.NPCType("Omnicide"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 13;
         *      }
         *      else if (npc.type == thoriummod.NPCType("SlagFury"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 13;
         *      }
         *      else if (npc.type == thoriummod.NPCType("RealityBreaker"))
         *      {
         *          npc.lifeMax = npc.lifeMax * 13;
         *      }
         *  }
         *  base.SetDefaults(npc);
         * }*/

        public override void OnChatButtonClicked(NPC npc, bool firstButton)
        {
            if (npc.type == NPCID.Nurse)
            {
                if (firstButton)
                {
                    MyPlayer modPlayer = Main.LocalPlayer.GetModPlayer <MyPlayer>();

                    modPlayer.kaiokenLevel = 0;
                    modPlayer.EndTransformations();
                    float kihealvalue = modPlayer.OverallKiMax() - modPlayer.GetKi();
                    modPlayer.AddKi(modPlayer.OverallKiMax(), false, false);
                    CombatText.NewText(new Rectangle((int)modPlayer.player.position.X, (int)modPlayer.player.position.Y, modPlayer.player.width, modPlayer.player.height), new Color(51, 204, 255), (int)Math.Round(kihealvalue, 0), false, false);
                    SoundHelper.PlayVanillaSound(SoundID.MaxMana, modPlayer.player);
                }
            }
        }
예제 #3
0
        public override void Update(Player player, ref int buffIndex)
        {
            if (player.whoAmI != Main.LocalPlayer.whoAmI)
            {
                return;
            }

            MyPlayer modPlayer = MyPlayer.ModPlayer(player);

            modPlayer.player.lifeRegen -= (int)TransformationDefinition.GetHealthDrainRate(modPlayer);
            modPlayer.kiDrainMulti      = TransformationDefinition.GetKiSkillDrainMultiplier(modPlayer);

            Vector2 lightPosition = player.Center + player.velocity * 8f;
            float   lightingR = 0f, lightingB = 0f, lightingG = 0f;

            TransformationDefinition.GetPlayerLightModifier(modPlayer, ref lightingR, ref lightingG, ref lightingB);

            if (lightingR > 0f || lightingG > 0f || lightingB > 0f)
            {
                Lighting.AddLight(lightPosition, lightingR, lightingG, lightingB);
            }

            // Give bonus base defense
            player.statDefense += TransformationDefinition.GetDefenseBonus(player.GetModPlayer <MyPlayer>());

            // handle ki drain mastery
            bool isMastered = modPlayer.PlayerTransformations.ContainsKey(TransformationDefinition) &&
                              modPlayer.PlayerTransformations[TransformationDefinition].Mastery >= 1.0;

            float actualKiDrain = isMastered ? TransformationDefinition.GetKiDrainRateMastery(modPlayer) : TransformationDefinition.GetKiDrainRate(modPlayer);

            float kiDrainMultiplier = 1f;

            if (!isMastered)
            {
                if (kiDrainMultiplier < 3f)
                {
                    _kiDrainAddTimer++;
                    if (_kiDrainAddTimer >= 300)
                    {
                        kiDrainMultiplier += 0.5f;
                        _kiDrainAddTimer   = 0;
                    }
                }
            }

            /*else // Mastered forms do not drain more over time.
             * {
             *  if (kiDrainMultiplier < 3f)
             *  {
             *      _kiDrainAddTimer++;
             *      if (_kiDrainAddTimer >= 600)
             *      {
             *          kiDrainMultiplier += 1f;
             *          _kiDrainAddTimer = 0;
             *      }
             *  }
             * }*/

            float projectedKiDrain = actualKiDrain * kiDrainMultiplier;

            TransformationDefinition transformation = modPlayer.GetCurrentTransformation();

            // if the player is in any ki-draining state, handles ki drain and power down when ki is depleted
            if (!DBZMOD.Instance.TransformationDefinitionManager.IsKaioken(transformation))
            {
                // player can't support ten frames (arbitrary) of their current form, make them fall out of any forms they might be in.
                if (modPlayer.IsKiDepleted(projectedKiDrain * MINIMUM_TRANSFORMATION_FRAMES_FOR_KI_COST_UPKEEP))
                {
                    if (transformation == DBZMOD.Instance.TransformationDefinitionManager.SuperKaiokenDefinition)
                    {
                        modPlayer.kaiokenLevel = 0;
                    }

                    modPlayer.EndTransformations();
                }
                else
                {
                    modPlayer.AddKi((projectedKiDrain) * -1, false, true);
                    Lighting.AddLight(player.Center, 1f, 1f, 0f);
                }
            }
            //else
            //{
            //    // the player isn't in a ki draining state anymore, reset KiDrainAddition
            //    modPlayer.kiDrainAddition = 0;
            //}

            float speedMultiplier = TransformationDefinition.GetSpeedMultiplier(modPlayer);

            player.moveSpeed       *= speedMultiplier;
            player.maxRunSpeed     *= speedMultiplier;
            player.runAcceleration *= speedMultiplier;

            if (player.jumpSpeedBoost < 1f)
            {
                player.jumpSpeedBoost = 1f;
            }

            player.jumpSpeedBoost *= speedMultiplier;

            // Set player damage mults
            float
                damageMultiplier       = TransformationDefinition.GetDamageMultiplier(modPlayer),
                halvedDamageMultiplier = GetHalvedDamageBonus(damageMultiplier);

            player.meleeDamage  *= halvedDamageMultiplier;
            player.rangedDamage *= halvedDamageMultiplier;
            player.magicDamage  *= halvedDamageMultiplier;
            player.minionDamage *= halvedDamageMultiplier;
            player.thrownDamage *= halvedDamageMultiplier;
            modPlayer.kiDamage  *= damageMultiplier;

            // cross mod support stuff
            if (DBZMOD.Instance.thoriumLoaded)
            {
                ThoriumEffects(player, damageMultiplier);
            }
            if (DBZMOD.Instance.enigmaLoaded)
            {
                EnigmaEffects(player, damageMultiplier);
            }
            if (DBZMOD.Instance.battlerodsLoaded)
            {
                BattleRodEffects(player, damageMultiplier);
            }
            if (DBZMOD.Instance.expandedSentriesLoaded)
            {
                ExpandedSentriesEffects(player, damageMultiplier);
            }

            if (player.buffTime[buffIndex] == 0)
            {
                TransformationDefinition.OnTransformationBuffExpired(modPlayer, ref buffIndex);
            }
        }