public void AddMon(Mon newMon) { MySqlConnection conn = DB.Connection(); conn.Open(); var cmd = conn.CreateCommand() as MySqlCommand; cmd.CommandText = @"INSERT INTO mons_battle (mons_id, battle_id) VALUES (@MonsId, @BattleId);"; cmd.Parameters.Add(new MySqlParameter("@MonsId", newMon.GetMonId())); cmd.Parameters.Add(new MySqlParameter("@BattleId", _battleId)); cmd.ExecuteNonQuery(); conn.Close(); if (conn != null) { conn.Dispose(); } }
public override bool Equals(System.Object otherMon) { if (!(otherMon is Mon)) { return(false); } else { Mon newMon = (Mon)otherMon; bool idEquality = this.GetMonId().Equals(newMon.GetMonId()); bool nameEquality = this.GetMonName().Equals(newMon.GetMonName()); bool hitpointsEquality = this.GetHitpoints().Equals(newMon.GetHitpoints()); bool attackEquality = this.GetAttack().Equals(newMon.GetAttack()); bool defenseEquality = this.GetDefense().Equals(newMon.GetMonName()); bool spattackEquality = this.GetSpecialattack().Equals(newMon.GetSpecialattack()); bool spdefenseEquality = this.GetSpecialdefense().Equals(newMon.GetSpecialdefense()); bool speedEquality = this.GetSpeed().Equals(newMon.GetSpeed()); return(idEquality && nameEquality && hitpointsEquality && attackEquality && defenseEquality && spattackEquality && spdefenseEquality && speedEquality); } }