本文整理汇总了C#中Terraria.Player.HasBuff方法的典型用法代码示例。如果您正苦于以下问题:C# Player.HasBuff方法的具体用法?C# Player.HasBuff怎么用?C# Player.HasBuff使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terraria.Player
的用法示例。
在下文中一共展示了Player.HasBuff方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UseItem
public override bool UseItem(Player player)
{
if (player.altFunctionUse == 2)
{
if (player.HasBuff(mod.BuffType("UnPowered")) >= 0)
{
}
else
{
player.AddBuff(mod.BuffType("PowerUnleash"), 1800);
player.AddBuff(mod.BuffType("UnPowered"), 7200);
}
}
return true;
}
示例2: UpdateAccessory
public override void UpdateAccessory(Player player)
{
if (player.HasBuff(BuffID.Chilled) >= 0 || player.HasBuff(BuffID.Frostburn) >= 0 || player.HasBuff(BuffID.Frozen) >= 0)
player.statDefense += 5;
player.maxRunSpeed -= 0.05F; // -5% move speed.
Lighting.AddLight(player.position, 0.5F, 0.5F, 0.5F); // Add a small, red light to the player.
}
示例3: UpdateAccessory
public override void UpdateAccessory(Player player)
{
// If the player has either of the buffs, add 1 defence.
if (player.HasBuff(BuffID.OnFire) >= 0 || player.HasBuff(BuffID.CursedInferno) >= 0)
player.statDefense += 1;
player.lavaMax += 30; // Half a second lava immunity
if (player.wet)
{
player.Hurt(1, 0); // If the player is in water, deal damage.
}
Lighting.AddLight(player.position, 0.5F, 0.1F, 0); // Add a small, red light to the player.
}
示例4: PlayerUpdate
public static void PlayerUpdate(Player p)
{
MultiBlocks.Do();
Waypoint.UpdateWaypoints();
if (Main.rand.Next(2000) == 0)
{
foreach (object ob in Ulterraria.Debugs)
{
if (ob != null)
{
Main.NewText(ob.ToString());
}
}
}
if (Main.keyState.IsKeyDown(XNA.Input.Keys.F) && Main.hasFocus && p.primesFury && p.HasBuff(192) == -1)
{
p.AddBuff(192, 1800);
}
int pFeatherAmount = 0;
int fFeatherAmount = 0;
int asteroidAmount = 0;
for (int i = 0; i < Main.projectile.Length; i++)
{
if (Main.projectile[i].type == 686)
{
pFeatherAmount++;
}
if (Main.projectile[i].type == 687)
{
fFeatherAmount++;
}
if (Main.projectile[i].type == 844)
{
asteroidAmount++;
}
}
if (p.phoenixFeather && Main.rand.Next(800) == 69 && pFeatherAmount < 4)
{
Projectile.NewProjectile(p.Center.X, p.Center.Y, 0, 0, 686, 67, 0f, Main.myPlayer);
}
if (p.kuiperBelt && Main.rand.Next(1100) == 69 && asteroidAmount < 6)
{
Projectile.NewProjectile(p.Center.X, p.Center.Y, 0, 0, 844, 81, 0f, Main.myPlayer);
}
if (p.froenixFeather && Main.rand.Next(800) == 69 && fFeatherAmount < 4)
{
Projectile.NewProjectile(p.Center.X, p.Center.Y, 0, 0, 687, 67, 0f, Main.myPlayer);
}
if (p.vanillaDamage > 0)
{
p.vanillaDamage -= 0.0005f;
if (p.vanillaDamage < 0)
{
p.vanillaDamage = 0f;
}
}
}
示例5: OnPlayerUpdateBuffs
public void OnPlayerUpdateBuffs(Player player)
{
foreach (var type in buffs)
{
var index = player.HasBuff(type);
if (index >= 0)
player.DelBuff(index);
player.buffImmune[type] = true;
}
}
示例6: UpdateAccessory
public override void UpdateAccessory(Player player)
{
// If the player has the 'Stoned' debuff.
if (player.HasBuff(BuffID.Stoned) >= 0)
player.statDefense += 1;
player.maxRunSpeed -= 0.1F; // -10% movespeed.
Lighting.AddLight(player.position, 0.5F, 0.4F, 0); // Add a small, orange light to the player.
}
示例7: UpdateAccessory
public override void UpdateAccessory(Player player)
{
player.lavaMax += 2; // 2 seconds lava invincibility.
if (player.HasBuff(BuffID.CursedInferno) >= 0 || player.lavaWet)
player.statDefense += 4;
player.buffImmune[BuffID.OnFire] = true;
if (player.wet)
{
player.Hurt(2, 0); // If the player is in water, deal damage.
}
Lighting.AddLight(player.position, 0.8F, 0.6F, 0); // Add a average, red light to the player.
}
示例8: UpdateInventory
public override void UpdateInventory(Player player)
{
if (player.HasBuff(mod.BuffType("PowerUnleash")) >= 0)
{
item.name = "Unleased Darkfire Katana";
item.damage = 145;
item.useTime = 8;
item.useAnimation = 8;
}
else
{
item.name = "Darkfire Katana";
item.damage = 110;
item.useTime = 12;
item.useAnimation = 12;
}
}
示例9: PlayerHurt
public static void PlayerHurt(Player p)
{
if (p.HasBuff(191) == -1 && p.cursedParchment)
{
p.AddBuff(191, 600);
}
if (p.spikedOrnaments && Main.rand.Next(0, 10) == 1)
{
Projectile.NewProjectile(p.Center.X, p.Center.Y, Main.rand.Next(-7, 8), -1, 692, 11, 0f, Main.myPlayer);
}
if (p.shardFetish && Main.rand.Next(0, 4) == 0)
{
int rand = Main.rand.Next(1, 4);
for (int i = 0; i < rand; i++)
{
if (Main.rand.Next(2) == 0)
{
int side = Main.rand.Next(4) <= 1 ? 3 : -3;
Projectile.NewProjectile(p.Center.X, p.Center.Y, side, Main.rand.Next(0, 4), 783, 5, 2f, Main.myPlayer);
}
else
{
int side1 = Main.rand.Next(4) <= 1 ? 3 : -3;
Projectile.NewProjectile(p.Center.X, p.Center.Y, Main.rand.Next(-3, 4), side1, 783, 5, 2f, Main.myPlayer);
}
}
}
}
示例10: AccessoryEffects
//.........这里部分代码省略.........
}
else if (p.statLife < p.statLifeMax2 / 3)
{
p.moveSpeed += 0.10f;
p.magicDamage += 0.10f;
p.meleeDamage += 0.10f;
p.minionDamage += 0.10f;
p.thrownDamage += 0.10f;
p.rangedDamage += 0.10f;
}
else if (p.statLife < p.statLifeMax2 / 2)
{
p.magicDamage += 0.05f;
p.meleeDamage += 0.05f;
p.minionDamage += 0.05f;
p.thrownDamage += 0.05f;
p.rangedDamage += 0.05f;
}
}
if (type == 3723)
{
p.wingTimeMax = 100;
}
if (type == 3934) //cream wings
{
p.wingTimeMax = 100;
}
if (type == 3935) //sprinkle wings
{
p.wingTimeMax = 120;
}
if (type == 3786)
{
if (p.HasBuff(25) != -1)
{
p.moveSpeed -= 0.05f;
p.lifeRegen += 1;
p.statDefense += 3;
p.meleeDamage += 0.05f;
}
}
if (type == 3791)
{
p.magicDamage += 0.02f;
p.meleeDamage += 0.02f;
p.minionDamage += 0.02f;
p.thrownDamage += 0.02f;
p.rangedDamage += 0.02f;
p.pickSpeed -= 0.05f;
}
if (type == 3792)
{
p.magicDamage += 0.05f;
p.meleeDamage += 0.05f;
p.minionDamage += 0.05f;
p.thrownDamage += 0.05f;
p.rangedDamage += 0.05f;
p.pickSpeed -= 0.10f;
}
if (type == 3897)
{
p.moveSpeed += 0.4f;
p.lifeRegen -= 1;
p.statDefense -= 5;
}
if (type == 4021)
示例11: SetBonuses
public static void SetBonuses(Player p)
{
if (p.head == 194 && p.body == 195 && p.legs == 135)
{
p.maxMinions++;
p.setBonus = "Increases your max number of minions by 1";
}
if (p.head == 195 && p.body == 196 && p.legs == 136)
{
p.buffImmune[46] = true;
p.setBonus = "Grants you immunity to the 'Chilled' debuff";
}
if (p.head == 196 && p.body == 197 && p.legs == 137)
{
if (p.HasBuff(12) == -1)
{
p.AddBuff(12, 60);
}
p.setBonus = "Grants you Night Vision";
}
if (p.head == 197 && p.body == 198 && p.legs == 138)
{
p.endurance += 0.07f;
p.setBonus = "Reduces damage taken by 7%";
}
if (p.head == 198 && p.body == 199 && p.legs == 139)
{
p.buffImmune[24] = true;
p.setBonus = "Grants you immunity to the 'On Fire!' debuff";
}
if (p.head == 199 && p.body == 200 && p.legs == 140)
{
p.cursedFlames = true;
p.setBonus = "Minions and weapons now inflict 'Cursed Inferno'";
}
if (p.head == 200 && p.body == 201 && p.legs == 141)
{
p.ichorQ = true;
p.setBonus = "Minions and weapons now inflict 'Ichor'";
}
if (p.head == 201 && p.body == 202 && p.legs == 142)
{
p.primeSkelArmour = true;
p.setBonus = "Greatly increased movement speed after striking an enemy";
}
if (p.head == 202 && p.body == 203 && p.legs == 143)
{
Lighting.AddLight((int)(p.position.X + (float)(p.width / 2)) / 16, (int)(p.position.Y + (float)(p.height / 2)) / 16, 0.8f, 0.95f, 1f);
p.setBonus = "You now emit light";
}
if (p.head == 203 && p.body == 204 && p.legs == 144)
{
p.shadowflame = true;
p.setBonus = "Minions and weapons now inflict 'Shadowflame'";
}
if (p.head == 204 && p.body == 205 && p.legs == 145)
{
p.spikedOrnaments = true;
p.setBonus = "Drop Spiked Ornaments when damaged";
}
if (p.head == 205 && p.body == 206 && p.legs == 146)
{
if (p.wet)
{
p.minionDamage += 0.3f;
}
p.setBonus = "Minions do far more damage underwater";
}
if (p.head == 208 && p.body == 207 && p.legs == 147)
{
p.statDefense += 1;
p.setBonus = "+1 Defense";
}
if (p.head == 209 && p.body == 208 && p.legs == 148)
{
p.vanillaValor = true;
p.setBonus = "Dealing melee damage increases melee damage.";
}
if (p.head == 210 && p.body == 208 && p.legs == 148)
{
p.chocolateCharge = true;
p.setBonus = "Speed increases ranged damage.";
}
if (p.head == 211 && p.body == 208 && p.legs == 148)
{
p.strawberryStrike = true;
p.statManaMax2 += 40;
p.setBonus = "Mana and life pickups are more fruitful. Increased maximum mana by 40.";
}
if (p.head == 212 && p.body == 209 && p.legs == 149)
{
p.statDefense += 4;
if (p.wet)
{
p.statDefense -= 5;
p.minionDamage += 0.35f;
}
p.setBonus = "+4 defence, when wet -5 defense and increased minion damage.";
}
if (p.head == 214 && p.body == 211 && p.legs == 151)
//.........这里部分代码省略.........