//based on type of card hide/show certain attributes in inspector /// <summary> /// Card --> Constructor /// </summary> public Cards() { name = null; caliber = 0; defType = 0; defaultAmount = 0; cardType = cardTypes.None; damage = 0; for (int i = 0; i < AttackScope.Length; i++) { AttackScope[i] = null; } moveDistance = new Vector3(0, 0, 0); for (int i = 0; i < isDirectionViable.Length; i++) { isDirectionViable[i] = true; } actType = 0; costType = 0; costAmount = 0; cfxDurationType = 0; cfxDurationAmount = 0; }
public CardPrototype() { type = cardTypes.MINION; cardName = ""; desc = ""; cost = 0; id = ""; tags = new List <string>(); art = ""; }
public List <BaseCards> GetCardsFromDb(string username) { List <BaseCards> cards = new List <BaseCards>(); string query = DbFunctions.MakeQueryGetCards(username); //Console.WriteLine(query); var commandDatabase = new NpgsqlCommand(query, _databaseConnection); commandDatabase.CommandTimeout = 60; try { _databaseConnection.Open(); var myReader = commandDatabase.ExecuteReader(); //Console.WriteLine(myReader); if (myReader.HasRows) { //Console.WriteLine("Query Generated result:"); while (myReader.Read()) { BaseCards temp = null; //Console.WriteLine(myReader.GetValue(0) + " - " + myReader.GetString(1) + " - " + myReader.GetString(2) + " - " + myReader.GetValue(3) + " - " + myReader.GetValue(4) + " - " + myReader.GetValue(5)); //nur zur übersicht string uid = myReader.GetString(0); elementTypes tempElementTypes = (elementTypes)Enum.Parse(typeof(elementTypes), myReader.GetString(1)); cardTypes tempCardTypes = (cardTypes)Enum.Parse(typeof(cardTypes), myReader.GetString(2)); cardProperty tempCardProperty = (cardProperty)Enum.Parse(typeof(cardProperty), myReader.GetString(3)); string name = myReader.GetString(4); int damage = myReader.GetInt32(5); if (tempCardTypes == cardTypes.Monster) { temp = new MonsterCard(uid, damage, name, tempElementTypes, tempCardProperty); } else if (tempCardTypes == cardTypes.Spell) { temp = new SpellCard(uid, damage, name, tempElementTypes); } cards.Add(temp); } } else { Console.WriteLine("Query Error!"); } } catch (Exception e) { Console.WriteLine("Query Error: " + e.Message); } _databaseConnection.Close(); return(cards); }
/// <summary> /// Support Card --> Constructor /// </summary> public Cards(string _name, int _caliber, defaultType _defType, int _defAmount, actionTypes _actType, costTypes _costType, int _costAmount, cfxDurationTypes _cfxDurationType, int _cfxDurationAmount) {//add functionality for at least 2 costTypes/amounts to be used name = _name; caliber = _caliber; defType = _defType; defaultAmount = _defAmount; cardType = cardTypes.Support; actType = _actType; costType = _costType; costAmount = _costAmount; cfxDurationType = _cfxDurationType; cfxDurationAmount = _cfxDurationAmount; numCards++; }
/// <summary> /// Attack Card --> Constructor /// </summary> /// <param name="_name"> The name of the card </param> /// <param name="_caliber"> The amount of points required to set the card </param> /// <param name="_defType"> The type of points derived from defaulting the card </param> /// <param name="_defAmount"> The amount of points derived from defaulting the card </param> /// <param name="_damage"> The amount of damage dealt by an attack card </param> /// <param name="_P1"> The first area in which a target can/will recieve damage from an attack card </param> /// <param name="_P2"> The second area in which a target can/will recieve damage from an attack card </param> /// <param name="_P3"> The third area in which a target can/will recieve damage from an attack card </param> /// <param name="_P4"> The fourth area in which a target can/will recieve damage from an attack card </param> /// <param name="_P5"> The fifth area in which a target can/will recieve damage from an attack card </param> /// <param name="_P6"> The final area in which a target can/will recieve damage from an attack card </param> public Cards(string _name, int _caliber, defaultType _defType, int _defAmount, int _damage, params Vector2?[] _point) { name = _name; caliber = _caliber; defType = _defType; defaultAmount = _defAmount; cardType = cardTypes.Attack; damage = _damage; AttackScope[(int)ScopePoints.P1] = _point[(int)ScopePoints.P1]; AttackScope[(int)ScopePoints.P2] = _point[(int)ScopePoints.P2]; AttackScope[(int)ScopePoints.P3] = _point[(int)ScopePoints.P3]; AttackScope[(int)ScopePoints.P4] = _point[(int)ScopePoints.P4]; AttackScope[(int)ScopePoints.P5] = _point[(int)ScopePoints.P5]; AttackScope[(int)ScopePoints.P6] = _point[(int)ScopePoints.P6]; numCards++; }
/// <summary> /// Move Card --> Constructor /// </summary> /// <param name="_name"> The name of the card </param> /// <param name="_caliber"> The amount of points required to set the card </param> /// <param name="_defType"> The type of points derived from defaulting the card </param> /// <param name="_defAmount"> The amount of points derived from defaulting the card </param> /// <param name="_moveDistance"> The travel distance enabled by a movement card - the sum of the x, y and z components can not exceed a value of 6 </param> /// <param name="_F"> Determines whether or not the card enables movement going forward </param> /// <param name="_FR"> Determines whether or not the card enables movement going forward and to the right </param> /// <param name="_BR"> Determines whether or not the card enables movement going backward and to the right </param> /// <param name="_B"> Determines whether or not the card enables movement going backward </param> /// <param name="_BL"> Determines whether or not the card enables movement going backward and to the left </param> /// <param name="_FL"> Determines whether or not the card enables movement going forward and to the left </param> public Cards(string _name, int _caliber, defaultType _defType, int _defAmount, Vector3 _moveDistance, params bool[] _direction) { name = _name; caliber = _caliber; defType = _defType; defaultAmount = _defAmount; cardType = cardTypes.Move; moveDistance = _moveDistance; //this can't be larger than 6. isDirectionViable[(int)directions.F] = _direction[(int)directions.F]; isDirectionViable[(int)directions.FR] = _direction[(int)directions.FR]; isDirectionViable[(int)directions.BR] = _direction[(int)directions.BR]; isDirectionViable[(int)directions.B] = _direction[(int)directions.B]; isDirectionViable[(int)directions.BL] = _direction[(int)directions.BL]; isDirectionViable[(int)directions.FL] = _direction[(int)directions.FL]; numCards++; }
public BaseCards GetOneCard(string card_uid) { BaseCards card = null; string query = "Select * from cardcollection where card_uid = '" + card_uid + "'"; var commandDatabase = new NpgsqlCommand(query, _databaseConnection); commandDatabase.CommandTimeout = 60; try { _databaseConnection.Open(); var myReader = commandDatabase.ExecuteReader(); //Console.WriteLine(myReader); while (myReader.Read()) { string cardUid = myReader.GetString(0); elementTypes tempElementTypes = (elementTypes)Enum.Parse(typeof(elementTypes), myReader.GetString(1)); cardTypes tempCardTypes = (cardTypes)Enum.Parse(typeof(cardTypes), myReader.GetString(2)); cardProperty tempCardProperty = (cardProperty)Enum.Parse(typeof(cardProperty), myReader.GetString(3)); string name = myReader.GetString(4); int damage = myReader.GetInt32(5); if (tempCardTypes == cardTypes.Monster) { card = new MonsterCard(cardUid, damage, name, tempElementTypes, tempCardProperty); } else if (tempCardTypes == cardTypes.Spell) { card = new SpellCard(cardUid, damage, name, tempElementTypes); } } } catch (Exception e) { Console.WriteLine("Query Error: " + e.Message); } _databaseConnection.Close(); return(card); }
public BaseCards GetOneRandCardFromDb(string query, int cardsNumber, int rand) { BaseCards temp = null; NpgsqlCommand commandDatabase = new NpgsqlCommand(query, _databaseConnection); commandDatabase.CommandTimeout = 60; int cardPlace = rand; cardPlace = cardPlace % cardsNumber; if (cardPlace == 0) { cardPlace = 1; } int counter = 0; try { _databaseConnection.Open(); var myReader = commandDatabase.ExecuteReader(); //Console.WriteLine(myReader); if (myReader.HasRows) { Console.WriteLine("Query Generated result:"); while (myReader.Read()) { //Console.WriteLine(myReader.GetValue(0) + " - " + myReader.GetString(1) + " - " + myReader.GetString(2) + " - " + myReader.GetValue(3) + " - " + myReader.GetValue(4) + " - " + myReader.GetValue(5)); //nur zur übersicht string cardUid = myReader.GetString(0); elementTypes tempElementTypes = (elementTypes)Enum.Parse(typeof(elementTypes), myReader.GetString(1)); cardTypes tempCardTypes = (cardTypes)Enum.Parse(typeof(cardTypes), myReader.GetString(2)); cardProperty tempCardProperty = (cardProperty)Enum.Parse(typeof(cardProperty), myReader.GetString(3)); string name = myReader.GetString(4); int damage = myReader.GetInt32(5); if (tempCardTypes == cardTypes.Monster) { temp = new MonsterCard(cardUid, damage, name, tempElementTypes, tempCardProperty); } else if (tempCardTypes == cardTypes.Spell) { temp = new SpellCard(cardUid, damage, name, tempElementTypes); } counter++; if (counter == cardPlace) { break; } } } else { Console.WriteLine("Query Error!"); } } catch (Exception e) { Console.WriteLine("Query Error: " + e.Message); } _databaseConnection.Close(); return(temp); }