public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit) { base.OnHitPlayer(npc, target, damage, crit); NPCEdits modNPC = npc.GetGlobalNPC <NPCEdits>(); modNPC.atkCooldown = modNPC.atkSpeed; }
public override bool PreAI(NPC npc) { NPCEdits modNPC = npc.GetGlobalNPC <NPCEdits>(); if (modNPC.stunTimer > 0 && modNPC.stunned == false) { stunTimer--; } if (modNPC.atkCooldown > 0) { atkCooldown -= 1; } if (modNPC.atkCooldown < 0) { atkCooldown = 0; } for (int col = 0; col < npc.immune.Length; col++) { if (npc.immune[col] > 15) { npc.immune[col] = 15; } } if (modNPC.stunned == true) { return(false); } return(base.PreAI(npc)); }
public override void ResetEffects(NPC npc) { base.ResetEffects(npc); NPCEdits modNPC = npc.GetGlobalNPC <NPCEdits>(); modNPC.atkSpeed = modNPC.defaultAtkSpeed; modNPC.stunned = false; }
public override void HitEffect(NPC npc, int hitDirection, double damage) { base.HitEffect(npc, hitDirection, damage); NPCEdits modNPC = npc.GetGlobalNPC <NPCEdits>(); if (npc.boss == false && modNPC.stunned == false && modNPC.stunTimer <= 0) { npc.AddBuff(mod.BuffType("Stun"), 30, true); } }
public override bool?CanHitNPC(Projectile projectile, NPC target) { NPCEdits modTarget = target.GetGlobalNPC <NPCEdits>(); ProjectileEdits modProjectile = projectile.GetGlobalProjectile <ProjectileEdits>(); if (modProjectile.minionProjectile && target.friendly) { return(false); } return(base.CanHitNPC(projectile, target)); }
public override void PostAI(NPC npc) { base.PostAI(npc); NPCEdits modNPC = npc.GetGlobalNPC <NPCEdits>(); for (int col = 0; col < npc.immune.Length; col++) { if (npc.immune[col] > 15) { npc.immune[col] = 15; } } }
public override bool CanHitPlayer(NPC npc, Player target, ref int cooldownSlot) { NPCEdits modNPC = npc.GetGlobalNPC <NPCEdits>(); if (modNPC.atkCooldown > 0) { return(false); } if (modNPC.stunned) { return(false); } return(base.CanHitPlayer(npc, target, ref cooldownSlot)); }
public override bool?CanHitNPC(NPC npc, NPC target) { NPCEdits modTarget = target.GetGlobalNPC <NPCEdits>(); NPCEdits modNPC = npc.GetGlobalNPC <NPCEdits>(); if (modNPC.atkCooldown > 0) { return(false); } if (modNPC.stunned) { return(false); } return(base.CanHitNPC(npc, target)); }
public override void SetDefaults(NPC npc) { NPCEdits modNPC = npc.GetGlobalNPC <NPCEdits>(); base.SetDefaults(npc); if (npc.type == NPCID.BlueJellyfish) { npc.catchItem = ItemID.BlueJellyfish; } if (npc.type == NPCID.PinkJellyfish) { npc.catchItem = ItemID.PinkJellyfish; } if (npc.type == NPCID.GreenJellyfish) { npc.catchItem = ItemID.GreenJellyfish; } }
public override void ModifyHitByProjectile(NPC npc, Projectile projectile, ref int damage, ref float knockback, ref bool crit, ref int hitDirection) { ProjectileEdits modProjectile = projectile.GetGlobalProjectile <ProjectileEdits>(); NPCEdits modNPC = npc.GetGlobalNPC <NPCEdits>(); if (projectile.magic || modProjectile.chemical) { damage += npc.defense / 2; if (projectile.magic) { damage -= modNPC.magicDefense / 2; } if (modProjectile.chemical) { damage -= modNPC.magicDefense / 4 - npc.defense / 4; } } base.ModifyHitByProjectile(npc, projectile, ref damage, ref knockback, ref crit, ref hitDirection); }
public override void ModifyHitByItem(NPC npc, Player player, Item item, ref int damage, ref float knockback, ref bool crit) { ItemEdits modItem = item.GetGlobalItem <ItemEdits>(); NPCEdits modNPC = npc.GetGlobalNPC <NPCEdits>(); if (item.magic || modItem.chemical) { damage += npc.defense / 2; if (item.magic) { damage -= modNPC.magicDefense / 2; } if (modItem.chemical) { damage -= modNPC.magicDefense / 4 - npc.defense / 4; } } base.ModifyHitByItem(npc, player, item, ref damage, ref knockback, ref crit); }
public override void HoldItem(Item item, Player player) { base.HoldItem(item, player); PlayerEdits modPlayer = player.GetModPlayer <PlayerEdits>(); ItemEdits modItem = item.GetGlobalItem <ItemEdits>(); if (item.melee == true) { if (modPlayer.job == JobID.rogue || modPlayer.armorJob == JobID.rogue) { if (modPlayer.rogueBonus == false) { player.armorPenetration += item.rare * 2; modPlayer.rogueBonus = true; } } } if (item.type == ItemID.PiranhaGun) { if (player.statMana < item.mana) { modItem.blocked = true; } else { modItem.blocked = false; } if (modItem.blocked == true) { player.controlUseItem = false; } if (player.controlUseItem == true && modItem.blocked == false && player.itemAnimation > 0) { if (modPlayer.itemCool == 0) { player.statMana -= item.mana; } if (modPlayer.itemCool == 0) { modPlayer.itemCool = item.useTime; } modPlayer.itemCool--; } } if (modItem.blocked == true) { player.controlUseItem = false; player.channel = false; } if (player.itemTime == item.useTime && player.controlUseItem && modItem.hasSummon) { if (!(modPlayer.usedMinionSlots + modItem.summonSlots > player.maxMinions)) { int id = NPC.NewNPC((int)player.Center.X, (int)player.Center.Y, modItem.summonNPC); NPC minion = Main.npc[id]; NPCEdits modMinion = minion.GetGlobalNPC <NPCEdits>(); modMinion.owner = Main.myPlayer; modPlayer.usedMinionSlots += modMinion.minionSlots; modMinion.minionSlots = modItem.summonSlots; player.numMinions++; modMinion.minionPos = player.numMinions; minion.damage = item.damage; } } }
public override bool PreHurt(bool pvp, bool quiet, ref int damage, ref int hitDirection, ref bool crit, ref bool customDamage, ref bool playSound, ref bool genGore, ref PlayerDeathReason damageSource) { if (immune) { return(false); } if (damageSource.SourceNPCIndex >= 0 && damageSource.SourceNPCIndex < Main.maxNPCs && Main.npc[damageSource.SourceNPCIndex] != null) { if (player.aggro < -250 && enInvis) { return(false); } NPCEdits modNPC = Main.npc[damageSource.SourceNPCIndex].GetGlobalNPC <NPCEdits>(); if (modNPC.atkCooldown > 0) { return(false); } } if (crit) { damage /= 2; } if (damageSource.SourceProjectileIndex >= 0 && damageSource.SourceProjectileIndex < Main.maxProjectiles && Main.projectile[damageSource.SourceProjectileIndex] != null) { Projectile projectile = Main.projectile[damageSource.SourceProjectileIndex]; ProjectileEdits modProjectile = projectile.GetGlobalProjectile <ProjectileEdits>(); if (projectile.magic || modProjectile.chemical) { if (Main.expertMode) { damage += player.statDefense * 3 / 4; if (projectile.owner < 255) { if (Main.player[projectile.owner].armorPenetration > 0) { damage -= Main.player[projectile.owner].armorPenetration; } } if (projectile.magic) { damage -= magicDefense * 3 / 4; } if (modProjectile.chemical) { damage -= magicDefense * 3 / 8 - player.statDefense * 3 / 8; } } else { damage += player.statDefense / 2; if (projectile.magic) { damage -= magicDefense / 2; } if (modProjectile.chemical) { damage -= magicDefense / 4 - player.statDefense / 4; } } } } if (pvp && damageSource.SourceItemType > 0 && damageSource.SourcePlayerIndex >= 0 && damageSource.SourcePlayerIndex < Main.maxPlayers && Main.player[damageSource.SourcePlayerIndex] != null) { Player sourcePlayer = Main.player[damageSource.SourcePlayerIndex]; Item item = sourcePlayer.HeldItem; if (damageSource.SourceItemType == item.type) { ItemEdits modItem = item.GetGlobalItem <ItemEdits>(); if (item.magic || modItem.chemical) { if (sourcePlayer.armorPenetration > 0) { damage -= player.armorPenetration; } if (Main.expertMode) { damage += player.statDefense * 3 / 4; if (item.magic) { damage -= magicDefense * 3 / 4; } if (modItem.chemical) { damage -= magicDefense * 3 / 8 - player.statDefense * 3 / 8; } } else { damage += player.statDefense / 2; if (item.magic) { damage -= magicDefense / 2; } if (modItem.chemical) { damage -= magicDefense / 4 - player.statDefense / 4; } } } } } if (crit) { damage *= 2; } if (gellyfishArmor) { if (damageSource.SourceNPCIndex >= 0 && damageSource.SourceNPCIndex < Main.maxNPCs && Main.npc[damageSource.SourceNPCIndex] != null) { NPC npc = Main.npc[damageSource.SourceNPCIndex]; player.ApplyDamageToNPC(npc, (int)((1 + (player.statDefense / 2)) * player.minionDamage), 5f, npc.direction * -1, false); } else if (damageSource.SourcePlayerIndex >= 0 && damageSource.SourcePlayerIndex < Main.maxPlayers && Main.player[damageSource.SourcePlayerIndex] != null) { Player sourcePlayer = Main.player[damageSource.SourcePlayerIndex]; PlayerDeathReason reason = new PlayerDeathReason(); reason.SourcePlayerIndex = player.whoAmI; reason.SourceCustomReason = Language.GetTextValue("Mods.ClassOverhaul.CommonName.Gellyfish"); sourcePlayer.Hurt(reason, (int)((1 + (player.statDefense / 2)) * player.minionDamage), sourcePlayer.direction * -1, true, false, false); } } return(base.PreHurt(pvp, quiet, ref damage, ref hitDirection, ref crit, ref customDamage, ref playSound, ref genGore, ref damageSource)); }