コード例 #1
0
        public override void GrabRange(Item Item, Player player, ref int grabRange)
        {
            SoraPlayer sp = player.GetModPlayer <SoraPlayer>();

            if (sp.invincible)
            {
                grabRange *= 500;
            }
        }
コード例 #2
0
        public void CollisionDetour(On.Terraria.Player.orig_Update_NPCCollision orig, Player self)
        {
            SoraPlayer sp = self.GetModPlayer <SoraPlayer>();

            if (sp.collisionDown)
            {
                if (!self.justJumped && self.velocity.Y >= 0)
                {
                    self.velocity.Y = 0;
                    self.fallStart  = (int)(self.position.Y / 16f);
                    self.position.Y = sp.collisionPoints.Y;
                    //self.position.Y = npc.position.Y - self.height + 4;
                    // orig(self);
                }
            }

            if (sp.collisionUp)
            {
                if (self.velocity.Y <= 0)
                {
                    //self.gfxOffY = npc.gfxOffY;
                    self.velocity.Y = 0;
                    self.fallStart  = (int)(self.position.Y / 16f);
                    self.position.Y = sp.collisionPoints.Y - self.height / 2;
                    //self.position.Y = npc.position.Y - self.height + 4;
                    // orig(self);
                }
            }

            if (sp.collisionLeft)
            {
                if (self.velocity.X <= 0)
                {
                    //self.gfxOffY = npc.gfxOffY;
                    self.velocity.X = 0;
                    //self.fallStart = (int)(self.position.Y / 16f);
                    self.position.X = sp.collisionPoints.X - self.width / 2;
                    //self.position.Y = npc.position.Y - self.height + 4; - self.width -
                    // orig(self);
                }
            }

            if (sp.collisionRight)
            {
                if (self.velocity.X >= 0)
                {
                    //self.gfxOffY = npc.gfxOffY;
                    self.velocity.X = 0;
                    //self.fallStart = (int)(self.position.Y / 16f);
                    self.position.X = sp.collisionPoints.X;
                    //self.position.Y = npc.position.Y - self.height + 4; - self.width -
                    // orig(self);
                }
            }

            orig(self);
        }
コード例 #3
0
        public override bool GrabStyle(Item Item, Player player)
        {
            SoraPlayer sp = player.GetModPlayer <SoraPlayer>();

            if (sp.invincible && player.CanAcceptItemIntoInventory(Item))
            {
                Item.velocity = (MathHelp.Magnitude(player.Center - Item.Center) <= 30) ?  Vector2.Zero: (MathHelp.Normalize(player.Center - Item.Center) * 30);
                if (MathHelp.Magnitude(player.Center - Item.Center) <= 45)
                {
                    Item.Center = player.Center;
                }
                return(false);
            }
            return(base.GrabStyle(Item, player));
        }
コード例 #4
0
        public override bool CanUseItem(Item Item, Player player)
        {
            SoraPlayer sp = player.GetModPlayer <SoraPlayer>();

            switch (Item.type)
            {
            case ItemID.WormFood:
                if (sp.fightingInBattleground)
                {
                    return(true);
                }
                break;
            }

            return(base.CanUseItem(Item, player));
        }
コード例 #5
0
        public override bool IsBiomeActive(Player player)
        {
            SoraPlayer sora = player.GetModPlayer <SoraPlayer>();

            return(sora.inTwilightTown);
        }
コード例 #6
0
 public void Update()
 {
     sora = Main.player[Main.myPlayer].GetModPlayer <SoraPlayer>();
 }
コード例 #7
0
 public static void Unload()
 {
     instance = null;
     sora     = null;
 }