當前位置: 首頁>>代碼示例>>C#>>正文


C# Player.HasBuff方法代碼示例

本文整理匯總了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;
        }
開發者ID:ColinAV516,項目名稱:Spirit-Mod,代碼行數:17,代碼來源:DarkfireKatana.cs

示例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.
        }
開發者ID:Eldrazi,項目名稱:Pletharia,代碼行數:9,代碼來源:FrostRing.cs

示例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.
        }
開發者ID:Eldrazi,項目名稱:Pletharia,代碼行數:14,代碼來源:FireproofRing.cs

示例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;
         }
     }
 }
開發者ID:thegamingboffin,項目名稱:Ulterraria_Reborn_GitHub,代碼行數:57,代碼來源:UlterrariaPlayers.cs

示例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;
     }
 }
開發者ID:Reuged,項目名稱:TerrariaPatcher,代碼行數:10,代碼來源:BuffImmunity.cs

示例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.
        }
開發者ID:Eldrazi,項目名稱:Pletharia,代碼行數:10,代碼來源:ReinforcedRing.cs

示例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.
        }
開發者ID:Eldrazi,項目名稱:Pletharia,代碼行數:14,代碼來源:BurningRose.cs

示例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;
     }
 }
開發者ID:ColinAV516,項目名稱:Spirit-Mod,代碼行數:17,代碼來源:DarkfireKatana.cs

示例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);
             }
         }
     }
 }
開發者ID:thegamingboffin,項目名稱:Ulterraria_Reborn_GitHub,代碼行數:28,代碼來源:UlterrariaPlayers.cs

示例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)
開發者ID:thegamingboffin,項目名稱:Ulterraria_Reborn_GitHub,代碼行數:67,代碼來源:UlterrariaPlayers.cs

示例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)
//.........這裏部分代碼省略.........
開發者ID:thegamingboffin,項目名稱:Ulterraria_Reborn_GitHub,代碼行數:101,代碼來源:UlterrariaPlayers.cs


注:本文中的Terraria.Player.HasBuff方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。