public ExecChangeMana(ExecChangeMana other) : base(other) { manaChange = new Mana(other.manaChange); manaType = other.manaType; nAmount = other.nAmount; }
public void RemoveMana(Mana.MANATYPE manaType) { if (plyrPaying == null) { Debug.Log("Cannot deallocate mana since no player is paying a mana cost"); return; } if (bCanPayCost == false) { Debug.Log("Cannot deallocate mana since this cost cannot be played with the player's mana resources"); return; } if (manaToSpendOnEffort[manaType] == 0) { Debug.Log("Cannot deallocate mana since we haven't allocated any mana of this colour for effort payments"); return; } //Decrement the requested type of mana manaToSpend[manaType]--; manaToSpendOnEffort[manaType]--; //Unreserve one mana that we had set aside in our mana pool to now be usable again plyrPaying.manapool.UnreserveMana(manaType); //Re-display the promised mana UpdateEffortManaIcons(); }
public ExecChangeMana(Chr _chrSource, Player _plyrTarget, Mana.MANATYPE _manaType, int _nAmount = 1) : base(_chrSource, _plyrTarget) { plyrTarget = _plyrTarget; manaType = _manaType; nAmount = _nAmount; }
public void AddMana(Mana.MANATYPE manaType) { if (plyrPaying == null) { Debug.Log("Cannot allocate mana since no player is paying a mana cost"); return; } if (bCanPayCost == false) { Debug.Log("Cannot allocate mana since this cost cannot be paid with the player's mana resources"); return; } if (manaToSpendOnEffort.GetTotalMana() == manaToPay[Mana.MANATYPE.EFFORT] && modTarMana.manaCostRequired.bXCost == false) { Debug.Log("Cannot allocate mana since we've already allocated enough for the full effort cost (and it's not an X cost)"); return; } if (plyrPaying.manapool.manaUsableToPay[manaType] == 0) { Debug.Log("Cannot allocate mana since we have already promised all our mana for this mana type"); return; } //Increment the requested type of mana manaToSpend[manaType]++; manaToSpendOnEffort[manaType]++; //Reserve one mana from our mana pool to be ready to pay for this payment plyrPaying.manapool.ReserveMana(manaType); //Re-display the promised mana UpdateEffortManaIcons(); }
public Mana.MANATYPE GetNextRandomManaForPlayer(int iPlayer) { Mana.MANATYPE manaReturn = PeekNextMana(iPlayer); ariRandomReserveProgression[iPlayer]++; //if we've advanced through all of our reserves if (ariRandomReserveProgression[iPlayer] == NRANDOMRESERVELENGTH) { //scramble their mana reserves RandomizePlayerReserves(iPlayer); //and reset the 'cursor' to the beginning ariRandomReserveProgression[iPlayer] = 0; } return(manaReturn); }
public string GetManaIconSpritePath(Mana.MANATYPE manatype, bool bPaidFor, Mana.MANATYPE manaPaidWith = Mana.MANATYPE.EFFORT) { if (bPaidFor == false) { return(string.Format("Images/Mana/CostUI/img{0}Unpaid", Mana.arsManaTypes[(int)manatype])); } else if (manatype != Mana.MANATYPE.EFFORT) { //For paid coloured mana return(string.Format("Images/Mana/CostUI/img{0}Paid", Mana.arsManaTypes[(int)manatype])); } else { //For paid effort mana return(string.Format("Images/Mana/CostUI/imgEffortPaidWith{0}", Mana.arsManaTypes[(int)manaPaidWith])); } }
public GameObject AddManaIcon(Mana.MANATYPE manaType, bool bPaidFor, Mana.MANATYPE manaPaidWith = Mana.MANATYPE.EFFORT) { GameObject goManaIcon = new GameObject(string.Format("sprManaIcon{0}", lstgoManaIcons.Count)); goManaIcon.transform.parent = goRequiredManaPosition.transform; SpriteRenderer sprRen = goManaIcon.AddComponent <SpriteRenderer>(); //Assign the appropriate sprite LibView.AssignSpritePathToObject(GetManaIconSpritePath(manaType, bPaidFor, manaPaidWith), goManaIcon); //Sacle the icon apropriately goManaIcon.transform.localScale = new Vector3(fManaSymbolSize, fManaSymbolSize, 1); //Place the icon at the appropriate spot goManaIcon.transform.localPosition = new Vector3(fManaSymbolSpacing * (0.5f + 1.5f * lstgoManaIcons.Count), 0f, 0f); //Ensure the symbol appears ahead of the mana panel sprRen.sortingOrder = 1; lstgoManaIcons.Add(goManaIcon); return(goManaIcon); }
public void ReplaceManaIcon(int indexToReplace, Mana.MANATYPE manaType, bool bPaidFor, Mana.MANATYPE manaPaidWith = Mana.MANATYPE.EFFORT) { LibView.AssignSpritePathToObject(GetManaIconSpritePath(manaType, bPaidFor, manaPaidWith), lstgoManaIcons[indexToReplace]); }
public void UnreserveMana(Mana.MANATYPE manaType) { manaReservedToPay.ChangeMana(manaType, -1); subManaChange.NotifyObs(this, manaType); }
public void ChangeMana(Mana.MANATYPE manaType, int nAmount = 1) { manaOwned.ChangeMana(manaType, nAmount); subManaChange.NotifyObs(this, manaType); }