Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public enum Faction { None, Lightbearers, Seaborn_Sharks, Farmers, Fanatics_of_Light, Volcanics, Eidetics, Patriots, Magi, Scavengers, The_Reluctant_Dead, Manakins, Watchers, Battleborns, Hexers, TechArtists, The_EndFairies };
- public enum CardType { None, Unit, Commander, Tactic };
- public enum UnitType { None, Soldier, Spellcaster};
- public enum SoldierType { None, Agent, Fighter};
- public enum SpellcasterType { None, Enhancer, Terraformer, Hexer, Caster, Channeller };
- public enum Location { Null, Deck, Reserves, Medbay, Graveyard, Field, FieldSoldier, FieldSpellcaster, Commander_Deck, Tactics, Hand, Target1}
- public enum TargetingType { SimpleTargeting }
- public enum SimpleTargetingType { ZoneList }
- public enum CARDS { ThisCard }
- public enum TriggerType { OtherEffect, Moving, PositionChange, AtWill, Battle, EnterField}
- //location will also need player id, and in some cases ids for sublocations (e.g. top of deck, left soldierslot)
- [System.Serializable]
- public class Effect : MonoBehaviour
- {
- public GameManager gameManager;
- public string description;
- public string choiceTitle;
- public Card attachedCard;
- public bool triggered;
- public bool atWill;
- public bool hasConditions;
- public int playerID;
- #region Conditions
- #endregion
- #region Triggers
- public struct TriggerVars
- {
- public bool isPreemptive;
- public bool isChoice;
- public int numberOfTriggers;
- public TriggerType triggerType;
- }
- public TriggerVars[] triggers;
- public bool TriggerCheck(TriggerVars trigger)
- {
- bool value = false;
- if (trigger.triggerType == TriggerType.EnterField)
- {
- CardTemplate attachedCardTmp = attachedCard.GetComponent<CardTemplate>();
- if (attachedCardTmp.justCreated == true & attachedCardTmp.inZone)
- {
- attachedCardTmp.justCreated = false;
- value = true;
- }
- }
- return value;
- }
- public void Update()
- {
- foreach (TriggerVars t in triggers)
- {
- TriggerCheck(t);
- }
- }
- #endregion
- #region Effects
- public CARDS[] cards1;
- public Location[] locations1;
- public Location[] locations2;
- public List<Card> cards1cards = new List<Card>();
- public List<CardTemplate> cards1Tmps = new List<CardTemplate>();
- #region Move [CARDS] in [LOCATION] to [LOCATION]
- IEnumerator Moving()
- {
- for (int i = 0; i < cards1.Length; i++)
- {
- if (cards1[i] == CARDS.ThisCard)
- {
- if (locations2[i] == Location.Target1)
- {
- if (targetings[1].targetType == TargetingType.SimpleTargeting)
- {
- StartCoroutine(SimpleTargeting(targetings[1]));
- while (!doneTargeting)
- {
- yield return null;
- }
- if (targetings[1].simpleTType == SimpleTargetingType.ZoneList)
- {
- GameObject cardPlayed = gameManager.CardTemplateGenerator(attachedCard, simpleTargetingZoneResults[0].gameObject.transform.position, simpleTargetingZoneResults[0].gameObject.transform.rotation);
- cardPlayed.GetComponent<CardTemplate>().inZone = true;
- cardPlayed.GetComponent<CardTemplate>().zoneIn = simpleTargetingZoneResults[0];
- }
- }
- }
- CardTemplate cardTmp = attachedCard.GetComponent<CardTemplate>();
- if (cardTmp.inHand)
- {
- gameManager.players[cardTmp.inHandPlayerID].hand.RemoveAt(cardTmp.handID);
- gameManager.UpdateAllHands();
- }
- }
- }
- yield return null;
- }
- #endregion
- #region Change [CARDS] position to [POSITION]
- #endregion
- #endregion
- #region Targeting
- int numberTargetings = 1;
- public struct TargetVars
- {
- public TargetingType targetType;
- public SimpleTargetingType simpleTType;
- public ZoneScript[] simpleTargetingZoneList;
- public int simpleTargetingMinChoices;
- public int simpleTargetingMaxChoices;
- public bool canBeOccupied;
- }
- public List<ZoneScript> simpleTargetingZoneResults = new List<ZoneScript>();
- public TargetVars[] targetings;
- bool doneTargeting = true;
- IEnumerator SimpleTargeting(TargetVars targeting)
- {
- doneTargeting = false;
- if (targeting.simpleTType == SimpleTargetingType.ZoneList)
- {
- List<ZoneScript> zoneChoices = new List<ZoneScript>();
- foreach (ZoneScript z in targeting.simpleTargetingZoneList)
- {
- if (targeting.canBeOccupied | !z.occupied)
- {
- z.MakeTarget(playerID, zoneChoices);
- }
- }
- if (targeting.simpleTargetingMinChoices == 1 && targeting.simpleTargetingMaxChoices == 1)
- {
- while (zoneChoices.Count != 1)
- {
- if (Input.GetMouseButtonDown(1))
- {
- foreach (ZoneScript z in targeting.simpleTargetingZoneList)
- {
- z.CancelTarget();
- }
- yield break;
- }
- yield return null;
- }
- }
- foreach (ZoneScript z in zoneChoices)
- {
- simpleTargetingZoneResults.Add(z);
- }
- foreach (ZoneScript z in targeting.simpleTargetingZoneList)
- {
- if (targeting.canBeOccupied | !z.occupied)
- {
- z.CancelTarget();
- }
- }
- }
- doneTargeting = true;
- yield return null;
- }
- #endregion
- #region SecondaryChoices
- #endregion
- #region Checks
- #endregion
- #region Placeholders
- #region CARDS
- #endregion
- #region LOCATION
- #endregion
- #region ZONES
- #endregion
- #endregion
- IEnumerator ActivateEffect()
- {
- gameManager.globalTriggerCheck = true;
- yield return null;
- }
- }
- public class Card : MonoBehaviour
- {
- //in-game variables
- public int ownerplayerID;
- public int controllerplayerID;
- //card qualities
- public string cardName = "";
- public Sprite cardImage;
- public Faction faction;
- public CardType cardType;
- public UnitType unitType;
- public SoldierType soldierType;
- public SpellcasterType spellcasterType;
- public int offence;
- public int defence;
- public bool isOffenceVar;
- public bool isDefenceVar;
- public bool isQuick;
- public bool hasInLocationEffects;
- public int numbInLocationEffects;
- public Location[] inLocationEffectLocations;
- public string effectText;
- //Construction variables
- private bool battlestats = false;
- //effects
- public bool triggerWhileInHand;
- public bool triggerWhileOnField;
- public bool triggerWhileInDeck;
- public bool triggerWhileInReserveDeck;
- public bool triggerWhileInGraveyard;
- public bool triggerWhileInMedBay;
- public bool triggerWhileInCommanderDeck;
- public int numberOfEffects;
- public List<Effect> effects = new List<Effect>();
- public void Assemble()
- {
- CardTemplate cardTemplate = GetComponent<CardTemplate>();
- cardTemplate.cardName.text = cardName;
- if (cardType == CardType.Commander)
- {
- cardTemplate.commanderBase.SetActive(true);
- cardTemplate.fighterBase.SetActive(false);
- cardTemplate.agentBase.SetActive(false);
- cardTemplate.spellcasterBase.SetActive(false);
- cardTemplate.tacticBase.SetActive(false);
- battlestats = true;
- }
- else if (cardType == CardType.Tactic)
- {
- cardTemplate.commanderBase.SetActive(false);
- cardTemplate.fighterBase.SetActive(false);
- cardTemplate.agentBase.SetActive(false);
- cardTemplate.spellcasterBase.SetActive(false);
- cardTemplate.tacticBase.SetActive(true);
- }
- else if (cardType == CardType.Unit)
- {
- if (unitType == UnitType.Soldier)
- {
- battlestats = true;
- if (soldierType == SoldierType.Fighter)
- {
- cardTemplate.commanderBase.SetActive(false);
- cardTemplate.fighterBase.SetActive(true);
- cardTemplate.agentBase.SetActive(false);
- cardTemplate.spellcasterBase.SetActive(false);
- cardTemplate.tacticBase.SetActive(false);
- }
- else if (soldierType == SoldierType.Agent)
- {
- cardTemplate.commanderBase.SetActive(false);
- cardTemplate.fighterBase.SetActive(false);
- cardTemplate.agentBase.SetActive(true);
- cardTemplate.spellcasterBase.SetActive(false);
- cardTemplate.tacticBase.SetActive(false);
- }
- }
- else if (unitType == UnitType.Spellcaster)
- {
- cardTemplate.commanderBase.SetActive(false);
- cardTemplate.fighterBase.SetActive(false);
- cardTemplate.agentBase.SetActive(false);
- cardTemplate.spellcasterBase.SetActive(true);
- cardTemplate.tacticBase.SetActive(false);
- }
- }
- if (battlestats)
- {
- cardTemplate.offenceText.gameObject.SetActive(true);
- cardTemplate.offenceNumber.gameObject.SetActive(true);
- cardTemplate.defenceText.gameObject.SetActive(true);
- cardTemplate.defenceNumber.gameObject.SetActive(true);
- cardTemplate.offenceNumber.text = offence.ToString();
- cardTemplate.defenceNumber.text = defence.ToString();
- }
- else
- {
- cardTemplate.offenceText.gameObject.SetActive(false);
- cardTemplate.offenceNumber.gameObject.SetActive(false);
- cardTemplate.defenceText.gameObject.SetActive(false);
- cardTemplate.defenceNumber.gameObject.SetActive(false);
- }
- cardTemplate.effectText.gameObject.SetActive(true);
- cardTemplate.effectText.text = effectText;
- }
- public string TextGenerate()
- {
- return "test";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement