-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New mob affixes #664
New mob affixes #664
Changes from 3 commits
e9ba959
9a15dfd
f8b6a3a
0ed89e6
f287e6d
480d019
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using PathOfTerraria.Common.Systems.MobSystem; | ||
using System.Collections.Generic; | ||
|
||
namespace PathOfTerraria.Common.Systems.Affixes; | ||
|
||
internal class MobAffixIconDrawing : GlobalNPC | ||
{ | ||
public override bool InstancePerEntity => true; | ||
|
||
private float _hoverStrength = 0; | ||
|
||
public override void PostDraw(NPC npc, SpriteBatch spriteBatch, Vector2 screenPos, Color drawColor) | ||
{ | ||
List<MobAffix> affixes = npc.GetGlobalNPC<ArpgNPC>().Affixes; | ||
|
||
if (affixes.Count == 0) | ||
{ | ||
return; | ||
} | ||
|
||
_hoverStrength = MathHelper.Lerp(_hoverStrength, npc.Hitbox.Contains(Main.MouseWorld.ToPoint()) ? 1 : 0, 0.1f); | ||
|
||
float offset = affixes.Count / 2f - 0.5f; | ||
float scale = MathHelper.Lerp(1f, 1.5f, _hoverStrength); | ||
float opacity = MathHelper.Lerp(0.6f, 1f, _hoverStrength); | ||
|
||
for (int i = 0; i < affixes.Count; i++) | ||
{ | ||
MobAffix affix = affixes[i]; | ||
|
||
Vector2 position = npc.Center - screenPos + new Vector2((i * 20 - offset * 20) * scale, -npc.height / 2 - 12); | ||
spriteBatch.Draw(affix.Icon.Value, position, null, drawColor * opacity, 0f, affix.Icon.Size() / 2f, scale, SpriteEffects.None, 0); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace PathOfTerraria.Common.Systems.Affixes.MobTypes; | ||
|
||
internal class DamageAffixes | ||
{ | ||
internal class DamageAffix : MobAffix | ||
{ | ||
public override void PostRarity(NPC npc) | ||
{ | ||
npc.damage = (int)(npc.damage * 1.5f); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
| ||
namespace PathOfTerraria.Common.Systems.Affixes.MobTypes; | ||
|
||
internal class SpeedAffixes | ||
{ | ||
public class FastAffix : MobAffix | ||
{ | ||
public override bool PreAI(NPC npc) | ||
{ | ||
npc.GetGlobalNPC<SpeedUpNPC>().ExtraAISpeed += 0.3f; | ||
return true; | ||
} | ||
} | ||
|
||
public class AggravatorAffix : MobAffix | ||
{ | ||
public override bool PreAI(NPC npc) | ||
{ | ||
if (npc.life < npc.lifeMax) | ||
{ | ||
npc.GetGlobalNPC<SpeedUpNPC>().ExtraAISpeed += 0.3f; | ||
npc.defense = npc.defDefense + 10; | ||
} | ||
|
||
return true; | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these should just be individual files tbh. I find these classes with multiple classes within it a bit hard to find sometimes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright, I was just following what had already been set up - DoubleLife was nested in a LifeAffixes class. |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using PathOfTerraria.Common.Enums; | ||
using PathOfTerraria.Common.Systems.MobSystem; | ||
|
||
namespace PathOfTerraria.Common.Systems.Affixes.MobTypes; | ||
|
||
internal class UniqueAffixes | ||
{ | ||
internal class SiphonerAffix : MobAffix | ||
{ | ||
public override ItemRarity MinimumRarity => ItemRarity.Rare; | ||
|
||
public class SiphonerNPC : GlobalNPC | ||
{ | ||
public override void OnHitPlayer(NPC npc, Player target, Player.HurtInfo hurtInfo) | ||
{ | ||
if (npc.GetGlobalNPC<ArpgNPC>().HasAffix<SiphonerAffix>()) | ||
{ | ||
target.CheckMana(hurtInfo.Damage / 2, true); | ||
} | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be looking for half health? Doesn't look like it is