Updated buffs sprites.

Updated fire amulet's synergy.
This commit is contained in:
FyloZ 2020-06-06 12:00:15 -04:00
parent 80adca9cf3
commit 80262bf100
46 changed files with 275 additions and 199 deletions

View File

@ -1,5 +1,5 @@
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ModLoader;
namespace Decimation.Content.Buffs.Buffs
{

View File

@ -1,6 +1,5 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Decimation.Lib.Buffs;
using Terraria;
namespace Decimation.Content.Buffs.Buffs
{

View File

@ -1,6 +1,5 @@
using Terraria;
using Terraria.ModLoader;
using Terraria.DataStructures;
using Decimation.Lib.Buffs;
using Terraria;
namespace Decimation.Content.Buffs.Buffs
{

View File

@ -1,4 +1,5 @@
using Terraria;
using Decimation.Lib.Buffs;
using Terraria;
namespace Decimation.Content.Buffs.Buffs
{

View File

@ -1,6 +1,5 @@
using Terraria;
using Terraria.ModLoader;
using Terraria.DataStructures;
using Decimation.Lib.Buffs;
using Terraria;
namespace Decimation.Content.Buffs.Buffs
{

View File

@ -1,4 +1,5 @@
using Decimation.Content.Projectiles;
using Decimation.Lib.Buffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;

View File

@ -1,4 +1,5 @@
using Microsoft.Xna.Framework.Input;
using Decimation.Lib.Buffs;
using Microsoft.Xna.Framework.Input;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

View File

@ -1,6 +1,5 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Decimation.Lib.Buffs;
using Terraria;
namespace Decimation.Content.Buffs.Buffs
{

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

After

Width:  |  Height:  |  Size: 474 B

View File

@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using Decimation.Lib.Buffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

View File

@ -1,5 +1,5 @@
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ModLoader;
namespace Decimation.Content.Buffs.Buffs
{

View File

@ -1,4 +1,5 @@
using Terraria;
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

View File

@ -1,4 +1,5 @@
using Terraria;
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ID;
namespace Decimation.Content.Buffs.Debuffs

View File

@ -1,6 +1,5 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Decimation.Lib.Buffs;
using Terraria;
namespace Decimation.Content.Buffs.Debuffs
{
@ -24,6 +23,7 @@ namespace Decimation.Content.Buffs.Debuffs
{
player.lifeRegen = 0;
}
player.lifeRegenTime = 0;
player.lifeRegen -= 3;
@ -36,6 +36,7 @@ namespace Decimation.Content.Buffs.Debuffs
{
npc.lifeRegen = 0;
}
npc.lifeRegenExpectedLossPerSecond += 3;
npc.lifeRegen -= 3;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 495 B

View File

@ -1,4 +1,5 @@
using Terraria;
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 392 B

After

Width:  |  Height:  |  Size: 402 B

View File

@ -1,4 +1,5 @@
using Terraria;
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

View File

@ -1,4 +1,5 @@
using Terraria;
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 B

After

Width:  |  Height:  |  Size: 393 B

View File

@ -1,4 +1,5 @@
using System;
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

After

Width:  |  Height:  |  Size: 486 B

View File

@ -1,4 +1,5 @@
using Terraria;
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

View File

@ -1,4 +1,5 @@
using Terraria;
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

View File

@ -1,4 +1,5 @@
using Terraria;
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

View File

@ -1,3 +1,4 @@
using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ModLoader;
using Terraria.DataStructures;

View File

@ -16,7 +16,7 @@ using Terraria.ModLoader.IO;
namespace Decimation.Content
{
public class DecimationPlayer : DecimationModPlayer
public class DecimationPlayer : ModPlayer
{
// Amulet slot
private Amulet _amuletSlotAmulet;
@ -69,8 +69,7 @@ namespace Decimation.Content
public bool wasJumping = false;
public ICollection<int> EquippedAccessories { get; } = new List<int>();
public override bool HasShield { get; set; }
public override bool HasLavaCharm { get; set; }
public bool HasShield { get; set; }
public Item AmuletSlotItem
{
@ -101,7 +100,6 @@ namespace Decimation.Content
tideTurnerEquipped = false;
vampire = false;
HasLavaCharm = false;
HasShield = false;
hasCursedAccessory = false;
@ -270,6 +268,8 @@ namespace Decimation.Content
if (AmuletSlotItem.type == ModContent.ItemType<CrystalAmulet>())
CrystalAmuletEffect();
_amuletSlotAmulet?.Synergy.OnHitPlayer(this, target, item, ref damage, ref crit);
}
public override void OnHitNPC(Item item, NPC target, int damage, float knockback, bool crit)
@ -281,6 +281,8 @@ namespace Decimation.Content
AmuletSlotItem.type != ModContent.ItemType<MarbleAmulet>())
if (Main.rand.Next(amuletsBuffChances, 100) < amuletsBuffChances)
target.AddBuff(amuletsBuff, amuletsBuffTime);
_amuletSlotAmulet?.Synergy.OnHitNPC(this, target, item, ref damage, ref crit);
}
public override void OnHitPvpWithProj(Projectile proj, Player target, int damage, bool crit)
@ -389,12 +391,12 @@ namespace Decimation.Content
public override void ModifyHitByNPC(NPC npc, ref int damage, ref bool crit)
{
_amuletSlotAmulet?.Synergy.OnHitPlayer(this, ref damage);
_amuletSlotAmulet?.Synergy.OnPlayerHit(this, ref damage);
}
public override void ModifyHitByProjectile(Projectile proj, ref int damage, ref bool crit)
{
_amuletSlotAmulet?.Synergy.OnHitPlayer(this, ref damage);
_amuletSlotAmulet?.Synergy.OnPlayerHit(this, ref damage);
}
public void DashMovement()
@ -829,7 +831,6 @@ namespace Decimation.Content
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;
if (item.type == ItemID.LavaCharm) modPlayer.HasLavaCharm = true;
}
}
}

View File

@ -1,5 +1,6 @@
using System.Collections.Generic;
using Decimation.Content.Buffs.Debuffs;
using Decimation.Content.Buffs.Buffs;
using Decimation.Content.Items.Ores;
using Decimation.Content.Tiles;
using Decimation.Lib.Items;

View File

@ -1,9 +1,9 @@
using System.Collections.Generic;
using Decimation.Content.Buffs.Debuffs;
using Decimation.Lib.Amulets;
using Decimation.Lib.Amulets.Synergy;
using Decimation.Content.Items.Accessories;
using Decimation.Content.Synergies;
using Decimation.Lib.Amulets;
using Decimation.Lib.Amulets.Synergy;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
@ -54,7 +54,9 @@ namespace Decimation.Content.Items.Amulets
.AddEffect("+3% melee critical strike chances")
.AddEffect("+7 seconds of immunity to lava")
.AddEffect("+4% chances to inflict \"Slimed!\" debuff to ennemies on strikes")
.AddSynergy("The lava charm grant an additional 5 seconds of lava immunity");
.AddSynergy("Grants an additional 5 seconds of effect to lava immunity accessories")
.AddSynergy("Fire melee weapons inflicts \"Slimed!\" to ennemies on strikes")
.AddSynergy("The Fiery Greatsword shoots fireballs");
}
}
}

View File

@ -1,9 +1,4 @@
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System;
using System.IO;
using Decimation.Content.Buffs.Debuffs;
using Decimation.Content.Items.Boss.Arachnus;
@ -11,15 +6,26 @@ using Decimation.Content.Items.Misc.Souls;
using Decimation.Content.Items.Weapons.Arachnus;
using Decimation.Content.Projectiles;
using Decimation.Content.Tiles.ShrineoftheMoltenOne;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Decimation.Content.NPCs.Arachnus
{
[AutoloadBossHead]
class Arachnus : ModNPC
internal class Arachnus : ModNPC
{
private int counter = 0;
private int counterMax = 1320;
private float speed = 2;
public enum ArachnusMessageType
{
RoarSound,
FlamesSound
}
private int _counter;
private int _counterMax = 1320;
private float _speed = 2;
public override void SetStaticDefaults()
{
@ -56,7 +62,7 @@ namespace Decimation.Content.NPCs.Arachnus
{
npc.lifeMax = (int) (npc.lifeMax * 0.625f * bossLifeScale);
npc.damage = (int) (npc.damage * 0.6f);
npc.defense = (int) (npc.defense + numPlayers * 2);
npc.defense = npc.defense + numPlayers * 2;
}
private bool CheckDispawn()
@ -83,18 +89,12 @@ namespace Decimation.Content.NPCs.Arachnus
// Move
Vector2 move = moveTo;
float magnitude = (float) Math.Sqrt(move.X * move.X + move.Y * move.Y);
if (magnitude > speed)
{
move *= speed / magnitude;
}
if (magnitude > _speed) move *= _speed / magnitude;
float turnResistance = 50f;
move = (npc.velocity * turnResistance + move) / (turnResistance + 1f);
magnitude = (float) Math.Sqrt(move.X * move.X + move.Y * move.Y);
if (magnitude > speed)
{
move *= speed / magnitude;
}
if (magnitude > _speed) move *= _speed / magnitude;
npc.velocity = npc.ai[1] != 99 ? move : new Vector2(0, 0);
}
@ -102,25 +102,19 @@ namespace Decimation.Content.NPCs.Arachnus
private bool CheckForShrine()
{
bool tooFarFromShrine = true;
if (counter % 60 == 0)
if (_counter % 60 == 0)
{
int validBlockCount = 0;
for (int i = (int) (-50 + npc.Center.X / 16f); i <= (int) (50 + npc.Center.X / 16f); i++)
{
for (int j = (int) (-50 + npc.Center.Y / 16f); j <= (int) (50 + npc.Center.Y / 16f); j++)
{
if (i >= 0 && i <= Main.maxTilesX && j >= 0 && j <= Main.maxTilesY)
{
if (Main.tile[i, j].type == ModContent.TileType<ShrineBrick>() ||
(Main.tile[i, j].type == ModContent.TileType<LockedShrineDoor>() ||
Main.tile[i, j].type == ModContent.TileType<LockedShrineDoor>() ||
Main.tile[i, j].type == ModContent.TileType<ShrineDoorClosed>() ||
Main.tile[i, j].type == ModContent.TileType<ShrineDoorOpened>()) ||
Main.tile[i, j].type == ModContent.TileType<ShrineDoorOpened>() ||
Main.tile[i, j].type == ModContent.TileType<RedHotSpike>() ||
Main.tile[i, j].type == ModContent.TileType<ShrineAltar>())
validBlockCount++;
}
}
}
if (validBlockCount < 15)
tooFarFromShrine = true;
@ -149,43 +143,46 @@ namespace Decimation.Content.NPCs.Arachnus
{
npc.velocity = new Vector2(0, 10f);
npc.noTileCollide = true;
if (npc.timeLeft > 10)
{
npc.timeLeft = 10;
}
if (npc.timeLeft > 10) npc.timeLeft = 10;
}
npc.TargetClosest(true);
npc.TargetClosest();
CheckEnraged();
// Normal ai
if (npc.ai[0] == 0)
{
float mouthX = (float) (((npc.height) / 2) * Math.Cos(npc.rotation - Math.PI * 0.5f)) + npc.Center.X;
float mouthY = (float) (((npc.height) / 2) * Math.Sin(npc.rotation - Math.PI * 0.5f)) + npc.Center.Y;
float mouthX = (float) (npc.height / 2 * Math.Cos(npc.rotation - Math.PI * 0.5f)) + npc.Center.X;
float mouthY = (float) (npc.height / 2 * Math.Sin(npc.rotation - Math.PI * 0.5f)) + npc.Center.Y;
//Counter
if (npc.life <= npc.lifeMax / 2) counterMax = 1500;
if (counter >= counterMax && Main.netMode != 1)
if (npc.life <= npc.lifeMax / 2) _counterMax = 1500;
if (_counter >= _counterMax && Main.netMode != 1)
{
counter = 0;
_counter = 0;
npc.netUpdate = true;
}
// Fireballs
if (counter <= 600) npc.ai[1] = 0;
else if (counter > 600 && counter < 800) npc.ai[1] = 98;
if (_counter <= 600)
{
npc.ai[1] = 0;
}
else if (_counter > 600 && _counter < 800)
{
npc.ai[1] = 98;
}
// Blast of Heat
else if (counter >= 800 && counter <= 1100)
else if (_counter >= 800 && _counter <= 1100)
{
npc.ai[1] = 1;
}
// Increase speed
else if (counter > 1320 && counter <= 1500 ||
(Main.expertMode && counter > 600 && counter < 800 && npc.life <= npc.lifeMax / 4))
else if (_counter > 1320 && _counter <= 1500 ||
Main.expertMode && _counter > 600 && _counter < 800 && npc.life <= npc.lifeMax / 4)
{
if (counter == 1321)
if (_counter == 1321)
{
if (Main.netMode == NetmodeID.SinglePlayer)
Main.PlaySound(SoundID.Roar, (int) npc.position.X, (int) npc.position.Y, 0);
@ -194,16 +191,19 @@ namespace Decimation.Content.NPCs.Arachnus
npc.ai[1] = 2;
}
else npc.ai[1] = 99;
else
{
npc.ai[1] = 99;
}
if (counter % 40 == 0 && npc.ai[1] == 0 && Main.netMode != 1)
if (_counter % 40 == 0 && npc.ai[1] == 0 && Main.netMode != 1)
{
float speedX = (float) (6 * Math.Cos(npc.rotation - Math.PI * 0.5f)) * 2;
float speedY = (float) (6 * Math.Sin(npc.rotation - Math.PI * 0.5f)) * 2;
Projectile.NewProjectile(new Vector2(mouthX, mouthY), new Vector2(speedX, speedY),
ModContent.ProjectileType<ArachnusFireball>(), 30, 0f);
}
else if (counter % 5 == 0 && npc.ai[1] == 1)
else if (_counter % 5 == 0 && npc.ai[1] == 1)
{
if (Main.netMode != 1)
{
@ -212,7 +212,7 @@ namespace Decimation.Content.NPCs.Arachnus
Projectile.NewProjectile(new Vector2(mouthX, mouthY), new Vector2(speedX, speedY),
npc.ai[2] == 1
? ModContent.ProjectileType<BlastofShadowFlame>()
: ModContent.ProjectileType<BlastofHeat>(), 30, 0f, 255);
: ModContent.ProjectileType<BlastofHeat>(), 30, 0f);
}
Main.PlaySound(SoundID.Item34, npc.position);
@ -221,21 +221,20 @@ namespace Decimation.Content.NPCs.Arachnus
}
else if (npc.ai[1] == 2)
{
speed = 20f;
_speed = 20f;
if (Main.expertMode)
{
speed = (npc.lifeMax - npc.life) / 500;
_speed = (npc.lifeMax - npc.life) / 500;
if (npc.ai[2] == 1)
speed += 20;
_speed += 20;
}
else if (npc.ai[2] == 1)
speed = 40f;
{
_speed = 40f;
}
}
if (npc.ai[1] != 2)
{
speed = 2f;
}
if (npc.ai[1] != 2) _speed = 2f;
// Enraged
if (npc.ai[2] == 1)
@ -245,12 +244,12 @@ namespace Decimation.Content.NPCs.Arachnus
if (npc.ai[1] != 2)
{
speed = 6f;
_speed = 6f;
npc.defense = 300;
}
}
counter++;
_counter++;
}
Move();
@ -258,16 +257,16 @@ namespace Decimation.Content.NPCs.Arachnus
public override void SendExtraAI(BinaryWriter writer)
{
writer.Write(counter);
writer.Write(counterMax);
writer.Write(speed);
writer.Write(_counter);
writer.Write(_counterMax);
writer.Write(_speed);
}
public override void ReceiveExtraAI(BinaryReader reader)
{
counter = reader.ReadInt32();
counterMax = reader.ReadInt32();
speed = reader.ReadSingle();
_counter = reader.ReadInt32();
_counterMax = reader.ReadInt32();
_speed = reader.ReadSingle();
}
private ModPacket GetPacket(ArachnusMessageType type)
@ -295,10 +294,7 @@ namespace Decimation.Content.NPCs.Arachnus
public override void OnHitPlayer(Player target, int damage, bool crit)
{
if (npc.ai[1] == 2 && Main.expertMode)
{
target.AddBuff(ModContent.BuffType<Hyperthermic>(), 900);
}
if (npc.ai[1] == 2 && Main.expertMode) target.AddBuff(ModContent.BuffType<Hyperthermic>(), 900);
base.OnHitPlayer(target, damage, crit);
}
@ -308,7 +304,7 @@ namespace Decimation.Content.NPCs.Arachnus
npc.frameCounter += 3f;
if (npc.frameCounter >= 40)
npc.frameCounter = 0;
npc.frame.Y = ((int) npc.frameCounter / 10) * frameHeight;
npc.frame.Y = (int) npc.frameCounter / 10 * frameHeight;
}
public override void NPCLoot()
@ -369,11 +365,5 @@ namespace Decimation.Content.NPCs.Arachnus
);
return false;
}
public enum ArachnusMessageType
{
RoarSound,
FlamesSound
}
}
}

View File

@ -1,4 +1,5 @@
using Decimation.Content.Buffs.Debuffs;
using Decimation.Content.Buffs.Buffs;
using Decimation.Content.Buffs.Debuffs;
using Decimation.Content.Tiles.ShrineoftheMoltenOne;
using Terraria;
using Terraria.ID;

View File

@ -1,4 +1,5 @@
using Decimation.Content.Buffs.Debuffs;
using Decimation.Content.Buffs.Buffs;
using Decimation.Content.Buffs.Debuffs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;

View File

@ -1,10 +1,11 @@
using Decimation.Content.Buffs.Debuffs;
using Decimation.Content.Buffs.Buffs;
using Decimation.Content.Dusts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Decimation.Content.Buffs.Debuffs;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;

View File

@ -2,6 +2,7 @@
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using Decimation.Content.Buffs.Buffs;
using Decimation.Content.Buffs.Debuffs;
using Microsoft.Xna.Framework;

View File

@ -1,5 +1,12 @@
using Decimation.Lib;
using Decimation.Content.Buffs.Debuffs;
using Decimation.Content.Items.Amulets;
using Decimation.Content.Projectiles;
using Decimation.Lib.Amulets.Synergy;
using Decimation.Lib.Util;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Decimation.Content.Synergies
{
@ -7,9 +14,60 @@ namespace Decimation.Content.Synergies
{
private const int AddedLavaTime = 500;
public override void Update(DecimationModPlayer modPlayer)
public override void Update(DecimationPlayer modPlayer)
{
if (modPlayer.HasLavaCharm) modPlayer.player.lavaMax += AddedLavaTime;
if (modPlayer.player.lavaMax > 0) modPlayer.player.lavaMax += AddedLavaTime;
}
public override void OnHitNPC(DecimationPlayer modPlayer, NPC target, Item weapon, ref int damages,
ref bool crit)
{
if (weapon.type.IsFireWeapon()) target.AddBuff(ModContent.BuffType<Singed>(), 500);
}
public override void OnHitPlayer(DecimationPlayer modPlayer, Player target, Item weapon, ref int damages,
ref bool crit)
{
if (weapon.type.IsFireWeapon()) target.AddBuff(ModContent.BuffType<Singed>(), 500);
}
private class FireAmuletSynergyFieryGreatswordEffect : GlobalItem
{
public override bool UseItem(Item item, Player player)
{
if (item.type == ItemID.FieryGreatsword &&
player.HasEquippedAmulet(ModContent.ItemType<FireAmulet>()))
{
int proj = Projectile.NewProjectile(player.Center + player.Directions * new Vector2(24, -16),
player.Directions * new Vector2(6, 0), ModContent.ProjectileType<ArachnusFireball>(), 30,
5f, player.whoAmI);
Main.projectile[proj].hostile = false;
Main.projectile[proj].friendly = true;
}
return true;
}
}
private class FireAmuletSynergyFlamarangEffect : GlobalProjectile
{
public override void OnHitNPC(Projectile projectile, NPC target, int damage, float knockback, bool crit)
{
if (projectile.type.IsFireMeleeProjectile() &&
Main.LocalPlayer.HasEquippedAmulet(ModContent.ItemType<FireAmulet>()))
{
target.AddBuff(ModContent.BuffType<Singed>(), 500);
}
}
public override void OnHitPlayer(Projectile projectile, Player target, int damage, bool crit)
{
if (projectile.type.IsFireMeleeProjectile() &&
Main.LocalPlayer.HasEquippedAmulet(ModContent.ItemType<FireAmulet>()))
{
target.AddBuff(ModContent.BuffType<Singed>(), 500);
}
}
}
}
}

View File

@ -1,5 +1,4 @@
using Decimation.Lib;
using Decimation.Lib.Amulets.Synergy;
using Decimation.Lib.Amulets.Synergy;
using Microsoft.Xna.Framework;
using Terraria;
@ -7,7 +6,7 @@ namespace Decimation.Content.Synergies
{
internal class GraniteAmuletSynergy : AmuletSynergyAdapter
{
public override void OnHitPlayer(DecimationModPlayer modPlayer, ref int damages)
public override void OnPlayerHit(DecimationPlayer modPlayer, ref int damages)
{
if (modPlayer.HasShield && Main.rand.NextBool(10))
{

View File

@ -1,5 +1,4 @@
using System;
using Decimation.Lib;
using Decimation.Lib.Amulets.Synergy;
using Microsoft.Xna.Framework;
using Terraria;
@ -9,25 +8,26 @@ namespace Decimation.Content.Synergies
{
internal class MarbleAmuletSynergy : AmuletSynergyAdapter
{
public override void OnShoot(DecimationModPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, ref float speedY,
public override void OnShoot(DecimationPlayer modPlayer, Item item, ref Vector2 position, ref float speedX,
ref float speedY,
ref int projectileType, ref int damages, ref float knockBack)
{
int itemType = modPlayer.player.HeldItem.type;
if (Main.rand.NextBool(4))
{
if (itemType == ItemID.Javelin || itemType == ItemID.Shuriken || itemType == ItemID.ThrowingKnife || itemType == ItemID.StarAnise || itemType == ItemID.BoneJavelin || itemType == ItemID.PoisonedKnife || itemType == ItemID.FrostDaggerfish)
if (itemType == ItemID.Javelin || itemType == ItemID.Shuriken || itemType == ItemID.ThrowingKnife ||
itemType == ItemID.StarAnise || itemType == ItemID.BoneJavelin ||
itemType == ItemID.PoisonedKnife || itemType == ItemID.FrostDaggerfish)
{
// Creation of the second projectile, with 10 degrees (0.174533 rad) rotation
const double angle = 0.174533d;
float x2 = (float)(Math.Cos(angle) * speedX - Math.Sin(angle) * speedY);
float y2 = (float)(Math.Sin(angle) * speedX + Math.Cos(angle) * speedY);
float x2 = (float) (Math.Cos(angle) * speedX - Math.Sin(angle) * speedY);
float y2 = (float) (Math.Sin(angle) * speedX + Math.Cos(angle) * speedY);
Projectile.NewProjectile(position, new Vector2(x2, y2), projectileType, damages, knockBack);
}
}
}
}
}

View File

@ -1,4 +1,5 @@
using Decimation.Content.Buffs.Debuffs;
using Decimation.Content.Buffs.Buffs;
using Decimation.Content.Buffs.Debuffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Terraria.ModLoader;
using Terraria.UI.Chat;
@ -15,13 +14,12 @@ namespace Decimation.Lib.Amulets
private readonly Color _synergyColor = Color.CadetBlue;
private int _effectCount;
private bool _hasSynergy;
public AmuletTooltip(Mod mod, Amulet amulet)
{
_mod = mod;
_amulet = amulet;
this.Lines = new List<TooltipLine>();
Lines = new List<TooltipLine>();
SetClassTooltip();
}
@ -30,7 +28,7 @@ namespace Decimation.Lib.Amulets
private void SetClassTooltip()
{
this.Lines.Add(new TooltipLine(_mod, "DecimationAmuletClass", _amulet.AmuletClass.ToString("F"))
Lines.Add(new TooltipLine(_mod, "DecimationAmuletClass", _amulet.AmuletClass.ToString("F"))
{
overrideColor = _classColor
});
@ -38,7 +36,7 @@ namespace Decimation.Lib.Amulets
public AmuletTooltip AddEffect(string tooltip)
{
this.Lines.Add(new TooltipLine(_mod, $"Effect{_effectCount}", tooltip)
Lines.Add(new TooltipLine(_mod, $"Effect{_effectCount}", tooltip)
{
overrideColor = _effectColor
});
@ -49,20 +47,11 @@ namespace Decimation.Lib.Amulets
public AmuletTooltip AddSynergy(string tooltip)
{
if (!_hasSynergy)
{
this.Lines.Add(new TooltipLine(_mod, "Synergy", tooltip)
Lines.Add(new TooltipLine(_mod, "Synergy", tooltip)
{
overrideColor = _synergyColor
});
_hasSynergy = true;
}
else
{
throw new InvalidOperationException($"Can't add more than one synergy tooltip to {_amulet.Name}");
}
return this;
}
}

View File

@ -1,26 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Decimation.Content;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace Decimation.Lib.Amulets.Synergy
{
public class AmuletSynergyAdapter : IAmuletsSynergy
{
public virtual void OnHitPlayer(DecimationModPlayer modPlayer, ref int damages)
public virtual void OnHitNPC(DecimationPlayer modPlayer, NPC target, Item weapon, ref int damages, ref bool crit)
{
}
public virtual void OnShoot(DecimationModPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, ref float speedY,
public virtual void OnHitPlayer(DecimationPlayer modPlayer, Player target, Item weapon, ref int damages,
ref bool crit)
{
}
public virtual void OnPlayerHit(DecimationPlayer modPlayer, ref int damages)
{
}
public virtual void OnShoot(DecimationPlayer modPlayer, Item item, ref Vector2 position, ref float speedX,
ref float speedY,
ref int projectileType, ref int damages, ref float knockBack)
{
}
public virtual void Update(DecimationModPlayer modPlayer)
public virtual void Update(DecimationPlayer modPlayer)
{
}
}

View File

@ -1,14 +1,15 @@
using Microsoft.Xna.Framework;
using Decimation.Content;
using Microsoft.Xna.Framework;
using Terraria;
namespace Decimation.Lib.Amulets.Synergy
{
public interface IAmuletsSynergy
{
void OnHitPlayer(DecimationModPlayer modPlayer, ref int damages);
void OnShoot(DecimationModPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int projectileType, ref int damages, ref float knockBack);
void Update(DecimationModPlayer modPlayer);
void OnHitNPC(DecimationPlayer modPlayer, NPC target, Item weapon, ref int damages, ref bool crit);
void OnHitPlayer(DecimationPlayer modPlayer, Player target, Item weapon, ref int damages, ref bool crit);
void OnPlayerHit(DecimationPlayer modPlayer, ref int damages);
void OnShoot(DecimationPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int projectileType, ref int damages, ref float knockBack);
void Update(DecimationPlayer modPlayer);
}
}

View File

@ -1,7 +1,7 @@
using Terraria.ModLoader;
using Terraria;
namespace Decimation.Content.Buffs
namespace Decimation.Lib.Buffs
{
internal abstract class DecimationBuff : ModBuff
{

View File

@ -1,14 +0,0 @@
using System.Collections.Generic;
using Decimation.Lib.Items;
using Decimation.Lib.Util;
using Terraria.ModLoader;
namespace Decimation.Lib
{
public abstract class DecimationModPlayer : ModPlayer, IDecimationPlayer
{
public abstract bool HasLavaCharm { get; set; }
public abstract bool HasShield { get; set; }
}
}

View File

@ -1,12 +0,0 @@
using Terraria.ModLoader;
namespace Decimation.Lib
{
public interface IDecimationPlayer
{
bool HasLavaCharm { get; }
bool HasShield { get; }
}
}

View File

@ -20,5 +20,10 @@ namespace Decimation.Lib.Util
{
return player.GetModPlayer().EquippedAccessories.Contains(accessoryType);
}
public static bool HasEquippedAmulet(this Player player, int amuletType)
{
return player.GetModPlayer().AmuletSlotItem.type == amuletType;
}
}
}

35
Lib/Util/WeaponUtils.cs Normal file
View File

@ -0,0 +1,35 @@
using System.Linq;
using Terraria.ID;
namespace Decimation.Lib.Util
{
public static class WeaponUtils
{
private static readonly int[] FireWeapons =
{
ItemID.FieryGreatsword,
ItemID.SolarFlarePickaxe,
ItemID.MoltenHamaxe,
ItemID.Sunfury,
ItemID.SolarEruption,
ItemID.SolarFlareHammer,
ItemID.HelFire,
ItemID.MoltenPickaxe
};
private static readonly int[] FireMeleeProjectiles =
{
ProjectileID.Flamarang
};
public static bool IsFireWeapon(this int itemType)
{
return FireWeapons.Contains(itemType);
}
public static bool IsFireMeleeProjectile(this int projectileType)
{
return FireMeleeProjectiles.Contains(projectileType);
}
}
}