private void Dice_Clicked(object sender, EventArgs e) { var obj = (DiceView)sender; // Avoid click out of turn if (obj.Parent == flowLayoutPanel1 && CurrentSprite != sprite1) { return; } if (obj.Parent == flowLayoutPanel2 && CurrentSprite != sprite2) { return; } var diceFace = obj.ThrowDice(); if (game.Hunting && diceFace.HasValue) { // Evita numeros negativos var x = diceFace.Value < 0 ? diceFace.Value * -1 : diceFace.Value; if (monsterS.AtackMonster(x)) { MessageBox.Show("Monster Defeated"); game.Player.Atack += 1; game.Player.Coins += monsterS.Coins; } else { MessageBox.Show("You lose"); game.Player.Life -= monsterS.Atack; } huntMonster1.Visible = false; CurrentSprite.deck.Controls.Remove(obj); SwitchPlayers(); game.Hunting = false; UpdateStatus(); AddDice(CurrentSprite); return; } if (diceFace.HasValue) { button1.Text = diceFace.ToString(); Mov(diceFace.Value, CurrentSprite); DoAction(); } else { if (obj.SpecialDice == Dice.Home) { game.Player.GoHome(); Mov(0, CurrentSprite); DoAction(); } else if (obj.SpecialDice == Dice.SmallPotion) { game.Player.AddLife(7); } else if (obj.SpecialDice == Dice.BigPotion) { game.Player.AddLife(15); } else if (obj.SpecialDice == Dice.Stunt) { game.Player.Stun(); } } CurrentSprite.deck.Controls.Remove(obj); if (!game.Hunting) { SwitchPlayers(); } UpdateStatus(); AddDice(CurrentSprite); }