// Clicking functionality. private void ItemBoxClick(UIMouseEvent evt, UIElement e) { // No failsafe. Should maybe be implemented? MorphBall morphBallTarget = Main.LocalPlayer.miscEquips[3].modItem as MorphBall; if (morphBallTarget.ballMods[morphBallSlotType] != null && !morphBallTarget.ballMods[morphBallSlotType].IsAir) { if (Main.mouseItem.IsAir) { Main.PlaySound(SoundID.Grab); Main.mouseItem = morphBallTarget.ballMods[morphBallSlotType].Clone(); morphBallTarget.ballMods[morphBallSlotType].TurnToAir(); } else if (condition == null || (condition != null && condition(Main.mouseItem))) { Main.PlaySound(SoundID.Grab); Item tempBoxItem = morphBallTarget.ballMods[morphBallSlotType].Clone(); Item tempMouseItem = Main.mouseItem.Clone(); morphBallTarget.ballMods[morphBallSlotType] = tempMouseItem; Main.mouseItem = tempBoxItem; } } else if (!Main.mouseItem.IsAir) { if (condition == null || (condition != null && condition(Main.mouseItem))) { Main.PlaySound(SoundID.Grab); morphBallTarget.ballMods[morphBallSlotType] = Main.mouseItem.Clone(); Main.mouseItem.TurnToAir(); } } }
protected override void DrawSelf(SpriteBatch spriteBatch) { MorphBall morphBallTarget = Main.LocalPlayer.miscEquips[3].modItem as MorphBall; spriteBatch.Draw(itemBoxTexture, drawRectangle, Color.White); // Item drawing. if (morphBallTarget.ballMods[morphBallSlotType].IsAir) { return; } Color itemColor = morphBallTarget.ballMods[morphBallSlotType].GetAlpha(Color.White); Texture2D itemTexture = Main.itemTexture[morphBallTarget.ballMods[morphBallSlotType].type]; CalculatedStyle innerDimensions = base.GetDimensions(); if (base.IsMouseHovering) { Main.hoverItemName = morphBallTarget.ballMods[morphBallSlotType].Name; Main.HoverItem = morphBallTarget.ballMods[morphBallSlotType].Clone(); } var frame = Main.itemAnimations[morphBallTarget.ballMods[morphBallSlotType].type] != null ? Main.itemAnimations[morphBallTarget.ballMods[morphBallSlotType].type].GetFrame(itemTexture) : itemTexture.Frame(1, 1, 0, 0); float drawScale = 1f; if ((float)frame.Width > innerDimensions.Width || (float)frame.Height > innerDimensions.Width) { if (frame.Width > frame.Height) { drawScale = innerDimensions.Width / (float)frame.Width; } else { drawScale = innerDimensions.Width / (float)frame.Height; } } var unreflectedScale = drawScale; var tmpcolor = Color.White; ItemSlot.GetItemLight(ref tmpcolor, ref drawScale, morphBallTarget.ballMods[morphBallSlotType].type); Vector2 drawPosition = new Vector2(innerDimensions.X, innerDimensions.Y); drawPosition.X += (float)innerDimensions.Width * 1f / 2f - (float)frame.Width * drawScale / 2f; drawPosition.Y += (float)innerDimensions.Height * 1f / 2f - (float)frame.Height * drawScale / 2f; spriteBatch.Draw(itemTexture, drawPosition, new Rectangle?(frame), itemColor, 0f, Vector2.Zero, drawScale, SpriteEffects.None, 0f); if (morphBallTarget.ballMods[morphBallSlotType].color != default(Color)) { spriteBatch.Draw(itemTexture, drawPosition, new Rectangle?(frame), itemColor, 0f, Vector2.Zero, drawScale, SpriteEffects.None, 0f); } }
public override void UpdateEffects(Player player) { MPlayer mp = player.GetModPlayer <MPlayer>(); if (player.miscEquips[3].type == mod.ItemType("MorphBall")) { mBall = (MorphBall)player.miscEquips[3].modItem; } else { mBall = null; } int sb = mod.ItemType("SpiderBallAddon"); int bb = mod.ItemType("BoostBallAddon"); mp.morphBall = true; mp.MorphBallBasic(player); if (mBall != null) { if (!mBall.ballMods[0].IsAir) { MGlobalItem drillMItem = mBall.ballMods[0].GetGlobalItem <MGlobalItem>(); mp.Drill(player, drillMItem.drillPower); } if (!mBall.ballMods[1].IsAir) { MGlobalItem bombMItem = mBall.ballMods[1].GetGlobalItem <MGlobalItem>(); mp.bombDamage = (int)(player.rangedDamage * bombMItem.bombDamage); mp.Bomb(player); } if (!mBall.ballMods[2].IsAir) { MGlobalItem pbMItem = mBall.ballMods[2].GetGlobalItem <MGlobalItem>(); mp.PowerBomb(player, pbMItem.powerBombType); } if (mBall.ballMods[3].type == sb) { mp.SpiderBall(player); } else { mp.spiderball = false; } if (mBall.ballMods[4].type == bb) { mp.BoostBall(player); } else { mp.boostCharge = 0; mp.boostEffect = 0; } } }
public static void Reset() { _engine.Stop(); Status = 0; //0 playing 1 end _engine = null; _lvlInfo = null; _player = null; _ball = null; _maxLife = 3; _life = null; _currentLife = _maxLife; _score = 0; _reward = null; _combo = 0; }