Added Titanic Paladin Shield
Added Titan Shield
This commit is contained in:
parent
82f501db45
commit
01a4ad3dea
@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Decimation.Content.Buffs.Buffs;
|
||||
using Decimation.Content.Items.Accessories;
|
||||
using Decimation.Content.Items.Accessories.Trinity;
|
||||
using Decimation.Content.Items.Amulets;
|
||||
using Decimation.Content.Items.Misc;
|
||||
using Decimation.Lib.Amulets;
|
||||
@ -10,7 +9,6 @@ using Decimation.Lib.Collections;
|
||||
using Decimation.Lib.Util;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.GameInput;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
@ -71,7 +69,6 @@ namespace Decimation.Content
|
||||
public bool wasJumping = false;
|
||||
|
||||
public ICollection<int> EquippedAccessories { get; } = new List<int>();
|
||||
public bool HasShield { get; set; }
|
||||
public bool NextHitCrit { get; set; }
|
||||
|
||||
public Item AmuletSlotItem
|
||||
@ -103,8 +100,6 @@ namespace Decimation.Content
|
||||
tideTurnerEquipped = false;
|
||||
vampire = false;
|
||||
|
||||
HasShield = false;
|
||||
|
||||
hasCursedAccessory = false;
|
||||
|
||||
player.statManaMax2 += hyperStars * HyperStar.ManaHealAmount;
|
||||
@ -433,6 +428,8 @@ namespace Decimation.Content
|
||||
crit = true;
|
||||
NextHitCrit = false;
|
||||
}
|
||||
|
||||
if (target.TeamHasEquippedAccessory(ModContent.ItemType<TitanShield>())) damage -= (int) (damage * 0.35f);
|
||||
}
|
||||
|
||||
public override void ModifyHitPvpWithProj(Projectile proj, Player target, ref int damage, ref bool crit)
|
||||
@ -447,11 +444,17 @@ namespace Decimation.Content
|
||||
public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit)
|
||||
{
|
||||
_amuletSlotAmulet?.Synergy.OnPlayerHit(this, ref damage);
|
||||
|
||||
if (this.TeamHasEquippedAccessory(ModContent.ItemType<TitanShield>())) damage -= (int) (damage * 0.35f);
|
||||
else if (this.TeamHasEquippedAccessory(ModContent.ItemType<TitanicPaladinShield>())) damage -= (int) (damage * 0.30f);
|
||||
}
|
||||
|
||||
public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit)
|
||||
{
|
||||
_amuletSlotAmulet?.Synergy.OnPlayerHit(this, ref damage);
|
||||
|
||||
if (this.TeamHasEquippedAccessory(ModContent.ItemType<TitanShield>())) damage -= (int) (damage * 0.35f);
|
||||
else if (this.TeamHasEquippedAccessory(ModContent.ItemType<TitanicPaladinShield>())) damage -= (int) (damage * 0.30f);
|
||||
}
|
||||
|
||||
private void SpawnWaspNecklaceWasps()
|
||||
@ -898,15 +901,4 @@ namespace Decimation.Content
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class PlayerPropertiesUpdater : GlobalItem
|
||||
{
|
||||
public override void UpdateAccessory(Item item, Player player, bool hideVisual)
|
||||
{
|
||||
DecimationPlayer modPlayer = player.GetModPlayer<DecimationPlayer>();
|
||||
if (item.type == ItemID.CobaltShield || item.type == ItemID.AnkhShield ||
|
||||
item.type == ItemID.PaladinsShield || item.type == ItemID.ObsidianShield) modPlayer.HasShield = true;
|
||||
base.UpdateAccessory(item, player, hideVisual);
|
||||
}
|
||||
}
|
||||
}
|
||||
56
Content/Items/Accessories/TitanShield.cs
Normal file
56
Content/Items/Accessories/TitanShield.cs
Normal file
@ -0,0 +1,56 @@
|
||||
using Decimation.Content.Items.Misc.Souls;
|
||||
using Decimation.Content.Items.Ores;
|
||||
using Decimation.Content.Tiles;
|
||||
using Decimation.Lib.Items;
|
||||
using Decimation.Lib.Util;
|
||||
using Decimation.Lib.Util.Builder;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace Decimation.Content.Items.Accessories
|
||||
{
|
||||
public class TitanShield : DecimationAccessory
|
||||
{
|
||||
protected override string ItemName => "Titan Shield";
|
||||
|
||||
protected override string ItemTooltip => "This is ridiculously heavy\n" +
|
||||
"Increases defense by 10\n" +
|
||||
"Increases all damages by 8%\n" +
|
||||
"Increases knockback by 8%\n" +
|
||||
"Increases all critical hit chances by 8%\n" +
|
||||
"Absords 35% of damage taken by members of your team";
|
||||
|
||||
protected override void InitAccessory()
|
||||
{
|
||||
item.width = 34;
|
||||
item.height = 40;
|
||||
item.defense = 10;
|
||||
item.value = Item.sellPrice(gold: 87, silver: 66);
|
||||
item.rare = Rarity.Cyan.GetRarityValue();
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
player.allDamage *= 1.08f;
|
||||
player.meleeCrit = (int) (player.meleeCrit * 1.08f);
|
||||
player.rangedCrit = (int) (player.rangedCrit * 1.08f);
|
||||
player.magicCrit = (int) (player.magicCrit * 1.08f);
|
||||
player.thrownCrit = (int) (player.thrownCrit * 1.08f);
|
||||
|
||||
player.EquipAccessory(ModContent.ItemType<TitanicPaladinShield>());
|
||||
}
|
||||
|
||||
protected override ModRecipe GetRecipe()
|
||||
{
|
||||
return new RecipeBuilder(this)
|
||||
.WithIngredient(ModContent.ItemType<TitanicPaladinShield>())
|
||||
.WithIngredient(ModContent.ItemType<TitaniteBar>(), 15)
|
||||
.WithIngredient(ItemID.Ectoplasm, 50)
|
||||
.WithIngredient(ModContent.ItemType<SoulofSpite>(), 20)
|
||||
.WithIngredient(ModContent.ItemType<DenziumBar>(), 15)
|
||||
.WithStation(ModContent.TileType<TitanForge>())
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Content/Items/Accessories/TitanShield.png
Normal file
BIN
Content/Items/Accessories/TitanShield.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 589 B |
75
Content/Items/Accessories/TitanicPaladinShield.cs
Normal file
75
Content/Items/Accessories/TitanicPaladinShield.cs
Normal file
@ -0,0 +1,75 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Decimation.Content.Tiles;
|
||||
using Decimation.Lib.Items;
|
||||
using Decimation.Lib.Util;
|
||||
using Decimation.Lib.Util.Builder;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace Decimation.Content.Items.Accessories
|
||||
{
|
||||
public class TitanicPaladinShield : DecimationAccessory
|
||||
{
|
||||
protected override string ItemName => "Titanic Paladin Shield";
|
||||
|
||||
protected override string ItemTooltip => "Increases defense by 8\n" +
|
||||
"Increases all damage by 5%\n" +
|
||||
"Increases knockback by 50%\n" +
|
||||
"Enables auto-swing on all melee weapons\n" +
|
||||
"Absords 30% of damage taken by members of your team";
|
||||
|
||||
protected override void InitAccessory()
|
||||
{
|
||||
item.width = 34;
|
||||
item.height = 42;
|
||||
item.defense = 8;
|
||||
item.value = Item.sellPrice(gold: 20, silver: 60);
|
||||
item.rare = Rarity.Yellow.GetRarityValue();
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
{
|
||||
player.allDamage *= 1.05f;
|
||||
}
|
||||
|
||||
protected override ModRecipe GetRecipe()
|
||||
{
|
||||
return new RecipeBuilder(this)
|
||||
.WithIngredient(ItemID.PaladinsShield)
|
||||
.WithIngredient(ItemID.TitanGlove)
|
||||
.WithIngredient(ItemID.SoulofNight, 15)
|
||||
.WithIngredient(ItemID.SoulofLight, 15)
|
||||
.WithIngredient(ItemID.SoulofMight, 15)
|
||||
.WithStation(ModContent.TileType<ChlorophyteAnvil>())
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
||||
class TitanicPaladinShieldItemEffect : GlobalItem
|
||||
{
|
||||
private static readonly Dictionary<int, bool> OriginalAutoswingState = new Dictionary<int, bool>();
|
||||
|
||||
public override void SetDefaults(Item item)
|
||||
{
|
||||
OriginalAutoswingState[item.type] = item.autoReuse;
|
||||
}
|
||||
|
||||
public override void GetWeaponKnockback(Item item, Player player, ref float knockback)
|
||||
{
|
||||
if (player.HasEquippedAccessory(ModContent.ItemType<TitanicPaladinShield>()))
|
||||
{
|
||||
knockback *= 1.5f;
|
||||
|
||||
if (item.melee && !OriginalAutoswingState[item.type])
|
||||
item.autoReuse = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (item.autoReuse && !OriginalAutoswingState[item.type])
|
||||
item.autoReuse = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
Content/Items/Accessories/TitanicPaladinShield.png
Normal file
BIN
Content/Items/Accessories/TitanicPaladinShield.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 822 B |
27
Content/ShieldID.cs
Normal file
27
Content/ShieldID.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using System.Collections.Generic;
|
||||
using Decimation.Content.Items.Accessories;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace Decimation.Content
|
||||
{
|
||||
public class ShieldID
|
||||
{
|
||||
public const int CobaltShield = ItemID.CobaltShield;
|
||||
public const int AnkhShield = ItemID.AnkhShield;
|
||||
public const int PaladinsShield = ItemID.PaladinsShield;
|
||||
public const int ObsidianShield = ItemID.ObsidianShield;
|
||||
public static readonly int TitanShield = ModContent.ItemType<TitanShield>();
|
||||
public static readonly int TitanicPaladinShield = ModContent.ItemType<TitanicPaladinShield>();
|
||||
|
||||
public static readonly List<int> Shields = new List<int>
|
||||
{
|
||||
CobaltShield,
|
||||
AnkhShield,
|
||||
PaladinsShield,
|
||||
ObsidianShield,
|
||||
TitanShield,
|
||||
TitanicPaladinShield
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using Decimation.Lib.Amulets.Synergy;
|
||||
using Decimation.Lib.Util;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
|
||||
@ -8,7 +9,7 @@ namespace Decimation.Content.Synergies
|
||||
{
|
||||
public override void OnPlayerHit(DecimationPlayer modPlayer, ref int damages)
|
||||
{
|
||||
if (modPlayer.HasShield && Main.rand.NextBool(10))
|
||||
if (modPlayer.HasEquippedShield() && Main.rand.NextBool(10))
|
||||
{
|
||||
damages = 0;
|
||||
CombatText.NewText(modPlayer.player.getRect(), Color.MediumPurple, "Blocked");
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
using Decimation.Lib.Util;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace Decimation.Lib.Items
|
||||
{
|
||||
@ -14,10 +15,13 @@ namespace Decimation.Lib.Items
|
||||
|
||||
InitAccessory();
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateAccessory(Player player, bool hideVisual)
|
||||
class AddAccessoriesToPlayerAccessoryList : GlobalItem
|
||||
{
|
||||
public override void UpdateAccessory(Item item, Player player, bool hideVisual)
|
||||
{
|
||||
player.EquipAccessory(this);
|
||||
player.EquipAccessory(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
using System.Linq;
|
||||
using Decimation.Content;
|
||||
using Decimation.Lib.Items;
|
||||
using Terraria;
|
||||
@ -14,7 +15,17 @@ namespace Decimation.Lib.Util
|
||||
|
||||
public static void EquipAccessory(this Player player, DecimationAccessory accessory)
|
||||
{
|
||||
player.GetModPlayer().EquippedAccessories.Add(accessory.item.type);
|
||||
player.EquipAccessory(accessory.item);
|
||||
}
|
||||
|
||||
public static void EquipAccessory(this Player player, Item accessory)
|
||||
{
|
||||
player.EquipAccessory(accessory.type);
|
||||
}
|
||||
|
||||
public static void EquipAccessory(this Player player, int item)
|
||||
{
|
||||
player.GetModPlayer().EquippedAccessories.Add(item);
|
||||
}
|
||||
|
||||
public static bool HasEquippedAccessory(this Player player, int accessoryType)
|
||||
@ -24,7 +35,7 @@ namespace Decimation.Lib.Util
|
||||
|
||||
public static bool HasEquippedAccessory(this ModPlayer modPlayer, int accessoryType)
|
||||
{
|
||||
return modPlayer.player.GetModPlayer().EquippedAccessories.Contains(accessoryType);
|
||||
return modPlayer.player.HasEquippedAccessory(accessoryType);
|
||||
}
|
||||
|
||||
public static bool HasEquippedAmulet(this Player player, int amuletType)
|
||||
@ -32,6 +43,35 @@ namespace Decimation.Lib.Util
|
||||
return player.GetModPlayer().AmuletSlotItem.type == amuletType;
|
||||
}
|
||||
|
||||
public static bool HasEquippedShield(this Player player)
|
||||
{
|
||||
return ShieldID.Shields.Count(player.HasEquippedAccessory) != 0;
|
||||
}
|
||||
|
||||
public static bool HasEquippedShield(this ModPlayer modPlayer)
|
||||
{
|
||||
return modPlayer.player.HasEquippedShield();
|
||||
}
|
||||
|
||||
public static bool TeamHasEquippedAccessory(this Player player, int accessoryType)
|
||||
{
|
||||
for (int i = 0; i < Main.player.Length; i++)
|
||||
{
|
||||
Player p = Main.player[i];
|
||||
if (p.active && !p.dead && p.team == player.team && p.HasEquippedAccessory(accessoryType))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool TeamHasEquippedAccessory(this ModPlayer modPlayer, int accessoryType)
|
||||
{
|
||||
return modPlayer.player.TeamHasEquippedAccessory(accessoryType);
|
||||
}
|
||||
|
||||
public static void LeechMana(this Player player, Entity target, int minMana = 5, int maxMana = 15)
|
||||
{
|
||||
int manaAmount = Main.rand.Next(minMana, maxMana + 1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user