コード例 #1
0
        public int AddDamage(int tileId, int damageAmount, bool updateAmount = true)
        {
            int i;

            if (tileId < 0 || tileId > 20)
            {
                return(0);
            }
            if (tileId == this.bufferLocation && damageAmount == 0)
            {
                return(0);
            }
            HitTile.HitTileObject hitTileObject = this.data[tileId];
            if (!updateAmount)
            {
                return(hitTileObject.damage + damageAmount);
            }
            HitTile.HitTileObject hitTileObject1 = hitTileObject;
            hitTileObject1.damage    = hitTileObject1.damage + damageAmount;
            hitTileObject.timeToLive = 60;
            if (tileId != this.bufferLocation)
            {
                i = 0;
                while (true)
                {
                    if (i <= 20)
                    {
                        if (this.order[i] == tileId)
                        {
                            break;
                        }
                        i++;
                    }
                    else
                    {
                        break;
                    }
                }
                while (i > 1)
                {
                    int num = this.order[i - 1];
                    this.order[i - 1] = this.order[i];
                    this.order[i]     = num;
                    i--;
                }
                this.order[1] = tileId;
            }
            else
            {
                this.bufferLocation = this.order[20];
                this.data[this.bufferLocation].Clear();
                for (i = 20; i > 0; i--)
                {
                    this.order[i] = this.order[i - 1];
                }
                this.order[0] = this.bufferLocation;
            }
            return(hitTileObject.damage);
        }
コード例 #2
0
ファイル: HitTile.cs プロジェクト: TerrariaJava/ExecutableSRC
        public void Prune()
        {
            bool flag = false;

            for (int i = 0; i <= 10; i++)
            {
                HitTile.HitTileObject hitTileObject = this.data[i];
                if (hitTileObject.type != 0)
                {
                    Tile tile = Main.tile[hitTileObject.X, hitTileObject.Y];
                    if (hitTileObject.timeToLive > 1)
                    {
                        HitTile.HitTileObject hitTileObject1 = hitTileObject;
                        hitTileObject1.timeToLive = hitTileObject1.timeToLive - 1;
                        if (hitTileObject.type == 1)
                        {
                            if (!tile.active())
                            {
                                hitTileObject.Clear();
                                flag = true;
                            }
                        }
                        else if (tile.wall == 0)
                        {
                            hitTileObject.Clear();
                            flag = true;
                        }
                    }
                    else
                    {
                        hitTileObject.Clear();
                        flag = true;
                    }
                }
            }
            if (!flag)
            {
                return;
            }
            int num = 1;

            while (flag)
            {
                flag = false;
                for (int j = num; j < 10; j++)
                {
                    if (this.data[this.order[j]].type == 0 && this.data[this.order[j + 1]].type != 0)
                    {
                        int num1 = this.order[j];
                        this.order[j]     = this.order[j + 1];
                        this.order[j + 1] = num1;
                        flag = true;
                    }
                }
            }
        }
コード例 #3
0
 public void UpdatePosition(int tileId, int x, int y)
 {
     if (tileId < 0 || tileId > 500)
     {
         return;
     }
     HitTile.HitTileObject hitTileObject = this.data[tileId];
     hitTileObject.X = x;
     hitTileObject.Y = y;
 }
コード例 #4
0
ファイル: HitTile.cs プロジェクト: windlex/mylualib
 // Token: 0x0600008B RID: 139 RVA: 0x0000B801 File Offset: 0x00009A01
 public void UpdatePosition(int tileId, int x, int y)
 {
     if (tileId < 0 || tileId > 20)
     {
         return;
     }
     HitTile.HitTileObject expr_12 = this.data[tileId];
     expr_12.X = x;
     expr_12.Y = y;
 }
コード例 #5
0
 public void ClearThisTile(int x, int y)
 {
     for (int tileId = 0; tileId <= 500; ++tileId)
     {
         HitTile.HitTileObject hitTileObject = this.data[this.order[tileId]];
         if (hitTileObject.X == x && hitTileObject.Y == y)
         {
             this.Clear(tileId);
             this.Prune();
         }
     }
 }
コード例 #6
0
ファイル: HitTile.cs プロジェクト: woodcrafter123/place
        public void UpdatePosition(int tileId, int x, int y)
        {
            if (tileId < 0 || tileId > 20)
            {
                return;
            }
            HitTile.HitTileObject hitTileObject = this.data[tileId];
            int num1 = x;

            hitTileObject.X = num1;
            int num2 = y;

            hitTileObject.Y = num2;
        }
コード例 #7
0
ファイル: HitTile.cs プロジェクト: windlex/mylualib
        // Token: 0x0600008C RID: 140 RVA: 0x0000B824 File Offset: 0x00009A24
        public int AddDamage(int tileId, int damageAmount, bool updateAmount = true)
        {
            if (tileId < 0 || tileId > 20)
            {
                return(0);
            }
            if (tileId == this.bufferLocation && damageAmount == 0)
            {
                return(0);
            }
            HitTile.HitTileObject hitTileObject = this.data[tileId];
            if (!updateAmount)
            {
                return(hitTileObject.damage + damageAmount);
            }
            hitTileObject.damage              += damageAmount;
            hitTileObject.timeToLive           = 60;
            hitTileObject.animationTimeElapsed = 0;
            hitTileObject.animationDirection   = (Main.rand.NextFloat() * 6.28318548f).ToRotationVector2() * 2f;
            if (tileId != this.bufferLocation)
            {
                for (int i = 0; i <= 20; i++)
                {
                    if (this.order[i] == tileId)
                    {
IL_10D:
                        while (i > 1)
                        {
                            int num = this.order[i - 1];
                            this.order[i - 1] = this.order[i];
                            this.order[i]     = num;
                            i--;
                        }
                        this.order[1] = tileId;
                        goto IL_11A;
                    }
                }
            }
            this.bufferLocation = this.order[20];
            this.data[this.bufferLocation].Clear();
            for (int i = 20; i > 0; i--)
            {
                this.order[i] = this.order[i - 1];
            }
            this.order[0] = this.bufferLocation;
IL_11A:
            return(hitTileObject.damage);
        }
コード例 #8
0
        public int AddDamage(int tileId, int damageAmount, bool updateAmount = true)
        {
            if (tileId < 0 || tileId > 10)
            {
                return(0);
            }
            if (tileId == this.bufferLocation && damageAmount == 0)
            {
                return(0);
            }
            HitTile.HitTileObject hitTileObject = this.data[tileId];
            if (!updateAmount)
            {
                return(hitTileObject.damage + damageAmount);
            }
            hitTileObject.damage    += damageAmount;
            hitTileObject.timeToLive = 60;
            if (tileId != this.bufferLocation)
            {
                int i;
                for (i = 0; i <= 10; i++)
                {
                    if (this.order[i] == tileId)
                    {
                        break;
                    }
                }
                while (i > 1)
                {
                    int num = this.order[i - 1];
                    this.order[i - 1] = this.order[i];
                    this.order[i]     = num;
                    i--;
                }
                this.order[1] = tileId;
                goto IL_EE;
            }
            this.bufferLocation = this.order[10];
            this.data[this.bufferLocation].Clear();
            for (int i = 10; i > 0; i--)
            {
                this.order[i] = this.order[i - 1];
            }
            this.order[0] = this.bufferLocation;
IL_EE:
            return(hitTileObject.damage);
        }
コード例 #9
0
 public int AddDamage(int tileId, int damageAmount, bool updateAmount = true)
 {
     if (tileId < 0 || tileId > 500 || tileId == this.bufferLocation && damageAmount == 0)
     {
         return(0);
     }
     HitTile.HitTileObject hitTileObject = this.data[tileId];
     if (!updateAmount)
     {
         return(hitTileObject.damage + damageAmount);
     }
     hitTileObject.damage              += damageAmount;
     hitTileObject.timeToLive           = 60;
     hitTileObject.animationTimeElapsed = 0;
     hitTileObject.animationDirection   = (Main.rand.NextFloat() * 6.283185f).ToRotationVector2() * 2f;
     this.SortSlots(tileId);
     return(hitTileObject.damage);
 }
コード例 #10
0
ファイル: HitTile.cs プロジェクト: woodcrafter123/Sources
 public int AddDamage(int tileId, int damageAmount, bool updateAmount = true)
 {
     if (tileId < 0 || tileId > 20 || tileId == this.bufferLocation && damageAmount == 0)
     {
         return(0);
     }
     HitTile.HitTileObject hitTileObject = this.data[tileId];
     if (!updateAmount)
     {
         return(hitTileObject.damage + damageAmount);
     }
     hitTileObject.damage              += damageAmount;
     hitTileObject.timeToLive           = 60;
     hitTileObject.animationTimeElapsed = 0;
     hitTileObject.animationDirection   = (Main.rand.NextFloat() * 6.283185f).ToRotationVector2() * 2f;
     if (tileId == this.bufferLocation)
     {
         this.bufferLocation = this.order[20];
         this.data[this.bufferLocation].Clear();
         for (int index = 20; index > 0; --index)
         {
             this.order[index] = this.order[index - 1];
         }
         this.order[0] = this.bufferLocation;
     }
     else
     {
         int index = 0;
         while (index <= 20 && this.order[index] != tileId)
         {
             ++index;
         }
         for (; index > 1; --index)
         {
             int num = this.order[index - 1];
             this.order[index - 1] = this.order[index];
             this.order[index]     = num;
         }
         this.order[1] = tileId;
     }
     return(hitTileObject.damage);
 }
コード例 #11
0
 public int TryFinding(int x, int y, int hitType)
 {
     for (int index1 = 0; index1 <= 500; ++index1)
     {
         int index2 = this.order[index1];
         HitTile.HitTileObject hitTileObject = this.data[index2];
         if (hitTileObject.type == hitType)
         {
             if (hitTileObject.X == x && hitTileObject.Y == y)
             {
                 return(index2);
             }
         }
         else if (index1 != 0 && hitTileObject.type == 0)
         {
             break;
         }
     }
     return(-1);
 }
コード例 #12
0
ファイル: HitTile.cs プロジェクト: saniainf/EDTerraria
 public int AddDamage(int tileId, int damageAmount, bool updateAmount = true)
 {
     if (tileId < 0 || tileId > 20 || tileId == this.bufferLocation && damageAmount == 0)
     {
         return(0);
     }
     HitTile.HitTileObject hitTileObject = this.data[tileId];
     if (!updateAmount)
     {
         return(hitTileObject.damage + damageAmount);
     }
     hitTileObject.damage    += damageAmount;
     hitTileObject.timeToLive = 60;
     if (tileId == this.bufferLocation)
     {
         this.bufferLocation = this.order[20];
         this.data[this.bufferLocation].Clear();
         for (int index = 20; index > 0; --index)
         {
             this.order[index] = this.order[index - 1];
         }
         this.order[0] = this.bufferLocation;
     }
     else
     {
         int index = 0;
         while (index <= 20 && this.order[index] != tileId)
         {
             ++index;
         }
         for (; index > 1; --index)
         {
             int num = this.order[index - 1];
             this.order[index - 1] = this.order[index];
             this.order[index]     = num;
         }
         this.order[1] = tileId;
     }
     return(hitTileObject.damage);
 }
コード例 #13
0
 public int HitObject(int x, int y, int hitType)
 {
     for (int index1 = 0; index1 <= 500; ++index1)
     {
         int index2 = this.order[index1];
         HitTile.HitTileObject hitTileObject = this.data[index2];
         if (hitTileObject.type == hitType)
         {
             if (hitTileObject.X == x && hitTileObject.Y == y)
             {
                 return(index2);
             }
         }
         else if (index1 != 0 && hitTileObject.type == 0)
         {
             break;
         }
     }
     HitTile.HitTileObject hitTileObject1 = this.data[this.bufferLocation];
     hitTileObject1.X    = x;
     hitTileObject1.Y    = y;
     hitTileObject1.type = hitType;
     return(this.bufferLocation);
 }
コード例 #14
0
        public void Prune()
        {
            bool flag = false;

            for (int index = 0; index <= 500; ++index)
            {
                HitTile.HitTileObject hitTileObject = this.data[index];
                if (hitTileObject.type != 0)
                {
                    Tile tile = Main.tile[hitTileObject.X, hitTileObject.Y];
                    if (hitTileObject.timeToLive <= 1)
                    {
                        hitTileObject.Clear();
                        flag = true;
                    }
                    else
                    {
                        --hitTileObject.timeToLive;
                        if ((double)hitTileObject.timeToLive < 12.0)
                        {
                            hitTileObject.damage -= 10;
                        }
                        else if ((double)hitTileObject.timeToLive < 24.0)
                        {
                            hitTileObject.damage -= 7;
                        }
                        else if ((double)hitTileObject.timeToLive < 36.0)
                        {
                            hitTileObject.damage -= 5;
                        }
                        else if ((double)hitTileObject.timeToLive < 48.0)
                        {
                            hitTileObject.damage -= 2;
                        }
                        if (hitTileObject.damage < 0)
                        {
                            hitTileObject.Clear();
                            flag = true;
                        }
                        else if (hitTileObject.type == 1)
                        {
                            if (!tile.active())
                            {
                                hitTileObject.Clear();
                                flag = true;
                            }
                        }
                        else if (tile.wall == (ushort)0)
                        {
                            hitTileObject.Clear();
                            flag = true;
                        }
                    }
                }
            }
            if (!flag)
            {
                return;
            }
            int num1 = 1;

            while (flag)
            {
                flag = false;
                for (int index = num1; index < 500; ++index)
                {
                    if (this.data[this.order[index]].type == 0 && this.data[this.order[index + 1]].type != 0)
                    {
                        int num2 = this.order[index];
                        this.order[index]     = this.order[index + 1];
                        this.order[index + 1] = num2;
                        flag = true;
                    }
                }
            }
        }
コード例 #15
0
        public void Prune()
        {
            bool flag = false;

            for (int i = 0; i <= 20; i++)
            {
                HitTile.HitTileObject hitTileObject = this.data[i];
                if (hitTileObject.type != 0)
                {
                    Tile tile = Main.tile[hitTileObject.X, hitTileObject.Y];
                    if (hitTileObject.timeToLive > 1)
                    {
                        HitTile.HitTileObject hitTileObject1 = hitTileObject;
                        hitTileObject1.timeToLive = hitTileObject1.timeToLive - 1;
                        if ((double)hitTileObject.timeToLive < 12)
                        {
                            HitTile.HitTileObject hitTileObject2 = hitTileObject;
                            hitTileObject2.damage = hitTileObject2.damage - 10;
                        }
                        else if ((double)hitTileObject.timeToLive < 24)
                        {
                            HitTile.HitTileObject hitTileObject3 = hitTileObject;
                            hitTileObject3.damage = hitTileObject3.damage - 7;
                        }
                        else if ((double)hitTileObject.timeToLive < 36)
                        {
                            HitTile.HitTileObject hitTileObject4 = hitTileObject;
                            hitTileObject4.damage = hitTileObject4.damage - 5;
                        }
                        else if ((double)hitTileObject.timeToLive < 48)
                        {
                            HitTile.HitTileObject hitTileObject5 = hitTileObject;
                            hitTileObject5.damage = hitTileObject5.damage - 2;
                        }
                        if (hitTileObject.damage < 0)
                        {
                            hitTileObject.Clear();
                            flag = true;
                        }
                        else if (hitTileObject.type == 1)
                        {
                            if (!tile.active())
                            {
                                hitTileObject.Clear();
                                flag = true;
                            }
                        }
                        else if (tile.wall == WallID.None)
                        {
                            hitTileObject.Clear();
                            flag = true;
                        }
                    }
                    else
                    {
                        hitTileObject.Clear();
                        flag = true;
                    }
                }
            }
            if (!flag)
            {
                return;
            }
            int num = 1;

            while (flag)
            {
                flag = false;
                for (int j = num; j < 20; j++)
                {
                    if (this.data[this.order[j]].type == 0 && this.data[this.order[j + 1]].type != 0)
                    {
                        int num1 = this.order[j];
                        this.order[j]     = this.order[j + 1];
                        this.order[j + 1] = num1;
                        flag = true;
                    }
                }
            }
        }
コード例 #16
0
ファイル: HitTile.cs プロジェクト: windlex/mylualib
        // Token: 0x0600008E RID: 142 RVA: 0x0000B9B8 File Offset: 0x00009BB8
        public void Prune()
        {
            bool flag = false;

            for (int i = 0; i <= 20; i++)
            {
                HitTile.HitTileObject hitTileObject = this.data[i];
                if (hitTileObject.type != 0)
                {
                    Tile tile = Main.tile[hitTileObject.X, hitTileObject.Y];
                    if (hitTileObject.timeToLive <= 1)
                    {
                        hitTileObject.Clear();
                        flag = true;
                    }
                    else
                    {
                        hitTileObject.timeToLive--;
                        if ((double)hitTileObject.timeToLive < 12.0)
                        {
                            hitTileObject.damage -= 10;
                        }
                        else if ((double)hitTileObject.timeToLive < 24.0)
                        {
                            hitTileObject.damage -= 7;
                        }
                        else if ((double)hitTileObject.timeToLive < 36.0)
                        {
                            hitTileObject.damage -= 5;
                        }
                        else if ((double)hitTileObject.timeToLive < 48.0)
                        {
                            hitTileObject.damage -= 2;
                        }
                        if (hitTileObject.damage < 0)
                        {
                            hitTileObject.Clear();
                            flag = true;
                        }
                        else if (hitTileObject.type == 1)
                        {
                            if (!tile.active())
                            {
                                hitTileObject.Clear();
                                flag = true;
                            }
                        }
                        else if (tile.wall == 0)
                        {
                            hitTileObject.Clear();
                            flag = true;
                        }
                    }
                }
            }
            if (!flag)
            {
                return;
            }
            int num = 1;

            while (flag)
            {
                flag = false;
                for (int j = num; j < 20; j++)
                {
                    if (this.data[this.order[j]].type == 0 && this.data[this.order[j + 1]].type != 0)
                    {
                        int num2 = this.order[j];
                        this.order[j]     = this.order[j + 1];
                        this.order[j + 1] = num2;
                        flag = true;
                    }
                }
            }
        }