Hurt() public method

public Hurt ( int Damage, int hitDirection, bool pvp = false, bool quiet = false, string deathText = " was slain...", bool Crit = false ) : double
Damage int
hitDirection int
pvp bool
quiet bool
deathText string
Crit bool
return double
示例#1
0
        public bool CanUse(Player p, int ind)
        {
            if(cost>p.statLife) return false;

            float defMod = (p.statDefense/2f);
            int dmg = (int)((cost) + defMod);
            p.Hurt(dmg, 0);
            return true;
        }
示例#2
0
        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.
        }
示例#3
0
        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
0
文件: Mount.cs 项目: MEFBAEA/mefbaea
 public void UseDrill(Player mountedPlayer)
 {
     if (this._type != 8 || !this._abilityActive)
     {
         return;
     }
     Mount.DrillMountData drillMountData = (Mount.DrillMountData)this._mountSpecificData;
     if (drillMountData.beamCooldown == 0)
     {
         int i = 0;
         while (i < drillMountData.beams.Length)
         {
             Mount.DrillBeam drillBeam = drillMountData.beams[i];
             if (drillBeam.cooldown == 0)
             {
                 Point16 point = this.DrillSmartCursor(mountedPlayer, drillMountData);
                 if (point != Point16.NegativeOne)
                 {
                     drillBeam.curTileTarget = point;
                     int pickPower = Mount.drillPickPower;
                     bool flag = mountedPlayer.whoAmI == Main.myPlayer;
                     if (flag)
                     {
                         bool flag2 = true;
                         if (WorldGen.InWorld((int)point.X, (int)point.Y, 0) && Main.tile[(int)point.X, (int)point.Y] != null && Main.tile[(int)point.X, (int)point.Y].type == 26 && !Main.hardMode)
                         {
                             flag2 = false;
                             mountedPlayer.Hurt(mountedPlayer.statLife / 2, -mountedPlayer.direction, false, false, Lang.deathMsg(-1, -1, -1, 4), false, -1);
                         }
                         if (flag2)
                         {
                             mountedPlayer.PickTile((int)point.X, (int)point.Y, pickPower);
                         }
                     }
                     Vector2 vector = new Vector2((float)(point.X << 4) + 8f, (float)(point.Y << 4) + 8f);
                     Vector2 v = vector - mountedPlayer.Center;
                     float num = v.ToRotation();
                     for (int j = 0; j < 2; j++)
                     {
                         float num2 = num + ((Main.rand.Next(2) == 1) ? -1f : 1f) * 1.57079637f;
                         float num3 = (float)Main.rand.NextDouble() * 2f + 2f;
                         Vector2 vector2 = new Vector2((float)Math.Cos((double)num2) * num3, (float)Math.Sin((double)num2) * num3);
                         int num4 = Dust.NewDust(vector, 0, 0, 230, vector2.X, vector2.Y, 0, default(Color), 1f);
                         Main.dust[num4].noGravity = true;
                         Main.dust[num4].customData = mountedPlayer;
                     }
                     if (flag)
                     {
                         Tile.SmoothSlope((int)point.X, (int)point.Y, true);
                     }
                     drillBeam.cooldown = Mount.drillPickTime;
                     break;
                 }
                 break;
             }
             else
             {
                 i++;
             }
         }
         drillMountData.beamCooldown = Mount.drillBeamCooldownMax;
     }
 }
 public override void OnHitPlayer(Player target, int damage, bool crit)
 {
     target.Hurt(5, projectile.direction);
 }
        /// <summary>
        /// Hurt a player when he/she touches a tile.
        /// </summary>
        /// <param name="p">The player who touches or doesn't touch the tile.</param>
        /// <param name="tileTypes">The types of the tiles to check.</param>
        /// <param name="damage">The damage to inflict to the player.</param>
        /// <param name="canHurt">A function used to check when to hurt the player.</param>
        /// <param name="deathText">The text do display when the player dies from the damage.</param>
        /// <param name="r">The radius.</param>
        public static void TileHurtPlayer(Player p, IEnumerable<int> tileTypes, int damage, Func<bool> canHurt = null, string deathText = " got slain...", int r = 0)
        {
            if (p.immune)
                return;

            bool hurt = TouchesTile(p, r, tileTypes);

            if (canHurt != null)
                hurt &= canHurt();

            if (hurt)
                p.Hurt(damage + (p.statDefense / 2), 0, false, false, deathText);
        }