本文整理汇总了C#中Terraria.Player.CountBuffs方法的典型用法代码示例。如果您正苦于以下问题:C# Player.CountBuffs方法的具体用法?C# Player.CountBuffs怎么用?C# Player.CountBuffs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terraria.Player
的用法示例。
在下文中一共展示了Player.CountBuffs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnPlayerQuickBuff
public bool OnPlayerQuickBuff(Player player)
{
if (player.noItems) return true;
if (player.chest != -1)
{
int num2 = 0;
for (int i = 0; i < 40; i++)
{
Chest chest;
if (player.chest > -1)
{
chest = Main.chest[player.chest];
}
else if (player.chest == -2)
{
chest = player.bank;
}
else
{
chest = player.bank2;
}
if (player.CountBuffs() == 22) return true;
if (chest.item[i].stack > 0 && chest.item[i].type > 0 && chest.item[i].buffType > 0 && !chest.item[i].summon && chest.item[i].buffType != 90)
{
int num3 = chest.item[i].buffType;
bool flag = true;
for (int j = 0; j < 22; j++)
{
if (num3 == 27 && (player.buffType[j] == num3 || player.buffType[j] == 101 || player.buffType[j] == 102))
{
flag = false;
break;
}
if (player.buffType[j] == num3)
{
flag = false;
break;
}
if (Main.meleeBuff[num3] && Main.meleeBuff[player.buffType[j]])
{
flag = false;
break;
}
}
if (Main.lightPet[chest.item[i].buffType] || Main.vanityPet[chest.item[i].buffType])
{
for (int k = 0; k < 22; k++)
{
if (Main.lightPet[player.buffType[k]] && Main.lightPet[chest.item[i].buffType])
{
flag = false;
}
if (Main.vanityPet[player.buffType[k]] && Main.vanityPet[chest.item[i].buffType])
{
flag = false;
}
}
}
if (chest.item[i].mana > 0 && flag)
{
if (player.statMana >= (int)((float)chest.item[i].mana * player.manaCost))
{
player.manaRegenDelay = (int)player.maxRegenDelay;
player.statMana -= (int)((float)chest.item[i].mana * player.manaCost);
}
else
{
flag = false;
}
}
if (player.whoAmI == Main.myPlayer && chest.item[i].type == 603 && !Main.cEd)
{
flag = false;
}
if (num3 == 27)
{
num3 = Main.rand.Next(3);
if (num3 == 0)
{
num3 = 27;
}
if (num3 == 1)
{
num3 = 101;
}
if (num3 == 2)
{
num3 = 102;
}
}
if (flag)
{
num2 = chest.item[i].useSound;
int num4 = chest.item[i].buffTime;
if (num4 == 0)
{
num4 = 3600;
}
player.AddBuff(num3, num4, true);
//.........这里部分代码省略.........