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;
using Terraria.ModLoader;
namespace Decimation.Content.Buffs.Buffs namespace Decimation.Content.Buffs.Buffs
{ {

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
using Decimation.Content.Projectiles; using Decimation.Content.Projectiles;
using Decimation.Lib.Buffs;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Terraria; using Terraria;
using Terraria.ID; 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;
using Terraria.ID; using Terraria.ID;
using Terraria.ModLoader; using Terraria.ModLoader;

View File

@ -1,6 +1,5 @@
using Terraria; using Decimation.Lib.Buffs;
using Terraria.ID; using Terraria;
using Terraria.ModLoader;
namespace Decimation.Content.Buffs.Buffs 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;
using Terraria.ID; using Terraria.ID;
using Terraria.ModLoader; using Terraria.ModLoader;

View File

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

View File

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

View File

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

View File

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

View File

@ -1,4 +1,5 @@
using Terraria; using Decimation.Lib.Buffs;
using Terraria;
using Terraria.ID; using Terraria.ID;
using Terraria.ModLoader; 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 System;
using Decimation.Lib.Buffs;
using Terraria; using Terraria;
using Terraria.ID; using Terraria.ID;
using Terraria.ModLoader; 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.ID;
using Terraria.ModLoader; using Terraria.ModLoader;

View File

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

View File

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

View File

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

View File

@ -16,7 +16,7 @@ using Terraria.ModLoader.IO;
namespace Decimation.Content namespace Decimation.Content
{ {
public class DecimationPlayer : DecimationModPlayer public class DecimationPlayer : ModPlayer
{ {
// Amulet slot // Amulet slot
private Amulet _amuletSlotAmulet; private Amulet _amuletSlotAmulet;
@ -69,8 +69,7 @@ namespace Decimation.Content
public bool wasJumping = false; public bool wasJumping = false;
public ICollection<int> EquippedAccessories { get; } = new List<int>(); public ICollection<int> EquippedAccessories { get; } = new List<int>();
public override bool HasShield { get; set; } public bool HasShield { get; set; }
public override bool HasLavaCharm { get; set; }
public Item AmuletSlotItem public Item AmuletSlotItem
{ {
@ -101,7 +100,6 @@ namespace Decimation.Content
tideTurnerEquipped = false; tideTurnerEquipped = false;
vampire = false; vampire = false;
HasLavaCharm = false;
HasShield = false; HasShield = false;
hasCursedAccessory = false; hasCursedAccessory = false;
@ -270,6 +268,8 @@ namespace Decimation.Content
if (AmuletSlotItem.type == ModContent.ItemType<CrystalAmulet>()) if (AmuletSlotItem.type == ModContent.ItemType<CrystalAmulet>())
CrystalAmuletEffect(); 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) 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>()) AmuletSlotItem.type != ModContent.ItemType<MarbleAmulet>())
if (Main.rand.Next(amuletsBuffChances, 100) < amuletsBuffChances) if (Main.rand.Next(amuletsBuffChances, 100) < amuletsBuffChances)
target.AddBuff(amuletsBuff, amuletsBuffTime); 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) 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) 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) 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() public void DashMovement()
@ -829,7 +831,6 @@ namespace Decimation.Content
DecimationPlayer modPlayer = player.GetModPlayer<DecimationPlayer>(); DecimationPlayer modPlayer = player.GetModPlayer<DecimationPlayer>();
if (item.type == ItemID.CobaltShield || item.type == ItemID.AnkhShield || if (item.type == ItemID.CobaltShield || item.type == ItemID.AnkhShield ||
item.type == ItemID.PaladinsShield || item.type == ItemID.ObsidianShield) modPlayer.HasShield = true; 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 System.Collections.Generic;
using Decimation.Content.Buffs.Debuffs; using Decimation.Content.Buffs.Debuffs;
using Decimation.Content.Buffs.Buffs;
using Decimation.Content.Items.Ores; using Decimation.Content.Items.Ores;
using Decimation.Content.Tiles; using Decimation.Content.Tiles;
using Decimation.Lib.Items; using Decimation.Lib.Items;

View File

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

View File

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

View File

@ -2,6 +2,7 @@
using Terraria; using Terraria;
using Terraria.ModLoader; using Terraria.ModLoader;
using Terraria.ID; using Terraria.ID;
using Decimation.Content.Buffs.Buffs;
using Decimation.Content.Buffs.Debuffs; using Decimation.Content.Buffs.Debuffs;
using Microsoft.Xna.Framework; 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.Amulets.Synergy;
using Decimation.Lib.Util;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace Decimation.Content.Synergies namespace Decimation.Content.Synergies
{ {
@ -7,9 +14,60 @@ namespace Decimation.Content.Synergies
{ {
private const int AddedLavaTime = 500; 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 Microsoft.Xna.Framework;
using Terraria; using Terraria;
@ -7,7 +6,7 @@ namespace Decimation.Content.Synergies
{ {
internal class GraniteAmuletSynergy : AmuletSynergyAdapter 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)) if (modPlayer.HasShield && Main.rand.NextBool(10))
{ {

View File

@ -1,5 +1,4 @@
using System; using System;
using Decimation.Lib;
using Decimation.Lib.Amulets.Synergy; using Decimation.Lib.Amulets.Synergy;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Terraria; using Terraria;
@ -9,15 +8,17 @@ namespace Decimation.Content.Synergies
{ {
internal class MarbleAmuletSynergy : AmuletSynergyAdapter internal class MarbleAmuletSynergy : AmuletSynergyAdapter
{ {
public override void OnShoot(DecimationPlayer modPlayer, Item item, ref Vector2 position, ref float speedX,
public override void OnShoot(DecimationModPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, ref float speedY, ref float speedY,
ref int projectileType, ref int damages, ref float knockBack) ref int projectileType, ref int damages, ref float knockBack)
{ {
int itemType = modPlayer.player.HeldItem.type; int itemType = modPlayer.player.HeldItem.type;
if (Main.rand.NextBool(4)) 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 // Creation of the second projectile, with 10 degrees (0.174533 rad) rotation
const double angle = 0.174533d; const double angle = 0.174533d;
@ -28,6 +29,5 @@ namespace Decimation.Content.Synergies
} }
} }
} }
} }
} }

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 Microsoft.Xna.Framework;
using Terraria; using Terraria;
using Terraria.ID; using Terraria.ID;

View File

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

View File

@ -1,26 +1,31 @@
using System; using Decimation.Content;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Terraria; using Terraria;
using Terraria.ModLoader;
namespace Decimation.Lib.Amulets.Synergy namespace Decimation.Lib.Amulets.Synergy
{ {
public class AmuletSynergyAdapter : IAmuletsSynergy 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) 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; using Terraria;
namespace Decimation.Lib.Amulets.Synergy namespace Decimation.Lib.Amulets.Synergy
{ {
public interface IAmuletsSynergy public interface IAmuletsSynergy
{ {
void OnHitPlayer(DecimationModPlayer modPlayer, ref int damages); 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 OnShoot(DecimationModPlayer modPlayer, Item item, ref Vector2 position, ref float speedX, ref float speedY, ref int projectileType, ref int damages, ref float knockBack); 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(DecimationModPlayer modPlayer); void Update(DecimationPlayer modPlayer);
} }
} }

View File

@ -1,7 +1,7 @@
using Terraria.ModLoader; using Terraria.ModLoader;
using Terraria; using Terraria;
namespace Decimation.Content.Buffs namespace Decimation.Lib.Buffs
{ {
internal abstract class DecimationBuff : ModBuff 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); 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);
}
}
}