//public override void AI(NPC npc) //{ // base.AI(npc); // if (npc.type != NPCID.GoblinSummoner) // { // if (npc.HasPlayerTarget && (!Main.player[npc.target].active || Main.player[npc.target].dead)) // { // npc.TargetClosest(); // if (npc.HasPlayerTarget && (!Main.player[npc.target].active || Main.player[npc.target].dead)) // { // npc.noTileCollide = true; // } // } // if (npc.noTileCollide) //fall through the floor // { // npc.position.Y++; // npc.velocity.Y++; // } // } //} public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit) { base.OnHitPlayer(npc, target, damage, crit); if (Main.hardMode) { target.AddBuff(ModContent.BuffType <Shadowflame>(), 300); } if (npc.type == NPCID.GoblinThief) { target.AddBuff(ModContent.BuffType <Midas>(), 600); if (target.whoAmI == Main.myPlayer && !target.GetModPlayer <FargoSoulsPlayer>().SecurityWallet&& Main.rand.NextBool()) { //try stealing mouse item, then selected item bool stolen = EModeGlobalNPC.StealFromInventory(target, ref Main.mouseItem); if (!stolen) { stolen = EModeGlobalNPC.StealFromInventory(target, ref target.inventory[target.selectedItem]); } if (stolen) { string text = Language.GetTextValue($"Mods.{mod.Name}.Message.ItemStolen"); Main.NewText(text, new Color(255, 50, 50)); CombatText.NewText(target.Hitbox, new Color(255, 50, 50), text, true); } /*byte extraTries = 30; * for (int i = 0; i < 3; i++) * { * bool successfulSteal = StealFromInventory(target, ref target.inventory[Main.rand.Next(target.inventory.Length)]); * * if (!successfulSteal && extraTries > 0) * { * extraTries--; * i--; * } * }*/ } } }
public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit) { base.OnHitPlayer(npc, target, damage, crit); target.AddBuff(ModContent.BuffType <LivingWasteland>(), 600); if (target.whoAmI == Main.myPlayer && !target.GetModPlayer <FargoSoulsPlayer>().SecurityWallet) { bool IsSoul(int type) { return(type == ItemID.SoulofFlight || type == ItemID.SoulofFright || type == ItemID.SoulofLight || type == ItemID.SoulofMight || type == ItemID.SoulofNight || type == ItemID.SoulofSight); }; bool stolen = false; if (IsSoul(Main.mouseItem.type) && EModeGlobalNPC.StealFromInventory(target, ref Main.mouseItem)) { stolen = true; } else { for (int j = 0; j < target.inventory.Length; j++) { Item item = target.inventory[j]; if (IsSoul(item.type)) { if (EModeGlobalNPC.StealFromInventory(target, ref target.inventory[j])) { stolen = true; } break; } } } if (stolen) { string text = Language.GetTextValue($"Mods.{mod.Name}.Message.ItemStolen"); Main.NewText(text, new Color(255, 50, 50)); CombatText.NewText(target.Hitbox, new Color(255, 50, 50), text, true); } } }
public override void OnHitPlayer(NPC npc, Player target, int damage, bool crit) { base.OnHitPlayer(npc, target, damage, crit); if (target.whoAmI == Main.myPlayer && !target.GetModPlayer <FargoSoulsPlayer>().SecurityWallet&& Main.rand.NextBool()) { //try stealing mouse item, then selected item bool stolen = EModeGlobalNPC.StealFromInventory(target, ref Main.mouseItem); if (!stolen) { stolen = EModeGlobalNPC.StealFromInventory(target, ref target.inventory[target.selectedItem]); } if (stolen) { string text = Language.GetTextValue($"Mods.{mod.Name}.Message.ItemStolen"); Main.NewText(text, new Color(255, 50, 50)); CombatText.NewText(target.Hitbox, new Color(255, 50, 50), text, true); } } target.AddBuff(ModContent.BuffType <Midas>(), 600); //target.AddBuff(ModContent.BuffType<LivingWasteland>(), 600); }