示例#1
0
        public override bool performToolAction(Tool t, int explosion, Vector2 tileLocation, GameLocation location)
        {
            if (location == null)
            {
                location = Game1.currentLocation;
            }

            if (t == null && explosion > 0)
            {
                ModEntry.GetReflection().GetMethod(this, "shake").Invoke(tileLocation, true);
                this.health -= Math.Min(explosion / 5f, 0.5f);
                if (this.health <= -1)
                {
                    DoDeath(location, tileLocation);
                    return(true);
                }
                return(false);
            }

            if (t != null && t is Axe)
            {
                location.playSound("leafrustle");
                ModEntry.GetReflection().GetMethod(this, "shake").Invoke(tileLocation, true);
                if ((t as Axe).UpgradeLevel >= minAxeLevel)
                {
                    this.health -= (t as Axe).UpgradeLevel / 5f;
                    if (this.health <= -1)
                    {
                        location.playSound("treethud");
                        DoDeath(location, tileLocation);
                        return(true);
                    }
                    location.playSound("axchop");
                }
            }
            return(false);
        }