Snrasha
Terrarian
http://forums.terraria.org/index.php?threads/1-3-tmodloader-a-modding-api.23726/page-582can some one help me with use a post draw method for a buff that work like medusa buff
This guys have same problems and i have answer.
im back here with questions for two things
1. can I make it, that a weapon makes more damage on the third succsesive hit?
2. can I make it, that a weapon hurts the player whenever you hit an enemy?
1)
This is simple, you create a variable private int value=0;
Then, maybe:
Code:
public override bool UseItem(Player player)
{
value++;
if(value==1)
item.damage*=2
if(value==2)
item.damage*=2;
if(value==3){
value=0;item.damage/=4;
}
//Or value++; here.
return base.UseItem(player);
}
This thing is better, but you need hit the ennemi:
private int value = 0;
public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit)
{
if (value == 1) damage= (int)(damage*1.2f);
if (value == 2) damage = (int)(damage * 1.6f);
if (value == 3) value = 0;
value++;
base.ModifyHitNPC(player, target, ref damage, ref knockBack, ref crit);
}
public override void ModifyHitNPC(Player player, NPC target, ref int damage, ref float knockBack, ref bool crit)
{
if (value == 1) damage= (int)(damage*1.2f);
if (value == 2) damage = (int)(damage * 1.6f);
if (value == 3) value = 0;
value++;
base.ModifyHitNPC(player, target, ref damage, ref knockBack, ref crit);
}
2) More simple: You use this method:
Code:
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
{
int spike = (int)Math.Floor((double)(damage / 100));
player.Hurt(spike, target.direction);
base.OnHitNPC(player, target, damage, knockBack, crit);
}
Last edited: