void DamageCheck(Being b) { if (b.GetResource("HP") == null) { Debug.Log("Damage check cannot find an HP resource in Being " + b.beingName); } else { Resource hp = b.GetResource("HP"); if (hp.GetCurrent() <= hp.last) { float damage = hp.last - hp.GetCurrent(); b.HPDamageThisTurn = damage; //Debug.Log(damage + " damage dealt to " + b.beingName); } else { float damage = hp.GetCurrent() - hp.last; b.HPDamageThisTurn = damage; // Debug.Log(damage + " hp added to " + b.beingName); } hp.last = hp.GetCurrent(); } }
IEnumerator waitToStart() { yield return(new WaitForSeconds(2)); //test stuff below Being a = beingFactory.CreateBeing("Goku"); beingFactory.AttackTeamBehaviour(a, 2); a.GetResource("POWERLEVEL").current += 150; Being b = beingFactory.CreateBeing("Gohan"); beingFactory.AttackTeamBehaviour(b, 2); //Being c = beingFactory.CreateBeing("Trunks"); //beingFactory.AttackTeamBehaviour(c, 2); //Being d = beingFactory.CreateBeing("Piccolo"); //beingFactory.AttackTeamBehaviour(d, 2); //beingFactory.DefendTeamReaction(d, 1); //Being e = beingFactory.CreateBeing("Frieza"); //beingFactory.AttackTeamBehaviour(e, 1); Being f = beingFactory.CreateBeing("Cell"); beingFactory.AttackTeamBehaviour(f, 1); //Being g = beingFactory.CreateBeing("Buu"); //beingFactory.AttackTeamBehaviour(g, 1); //Being h = beingFactory.CreateBeing("Saibaman"); //beingFactory.AttackTeamBehaviour(h, 1); //beingFactory.DefendTeamReaction(h, 2); a.team = 1; //b.team = 1; c.team = 1; d.team = 1; //e.team = 2; f.team = 2; g.team = 2; h.team = 2; f.team = 2; b.team = 1; b.playerControlled = true; //actionManager.combatants.Add(b); //actionManager.combatants.Add(c); //gameState = GameStates.BATTLE; //actionManager.StartCombat(); //Display the names, resources, etc of the Beings in Combat List <Being> beingList = new List <Being>(); beingList.Add(a); beingList.Add(b); beingList.Add(f); uiManager.DisplayCombatantInfo(beingList); }
public override void Use(Being target) { Resource actualTargetResource; if (targetSelf) { actualTargetResource = parentBeing.GetResource(targetResource); ResourceModifier rm = new ResourceModifier(value); actualTargetResource.Modify(rm); } if (!targetSelf) { actualTargetResource = target.GetResource(targetResource); ResourceModifier rm = new ResourceModifier(value); actualTargetResource.Modify(rm); } }
public override void Use(Being target) { Debug.Log("Modulate resource: " + targetResource + " " + value + " on " + target.beingName); Resource actualTargetResource; if (targetSelf) { actualTargetResource = parentBeing.GetResource(targetResource); ResourceModifier rm = new ResourceModifier(value); actualTargetResource.Modify(rm); } if (!targetSelf) { actualTargetResource = target.GetResource(targetResource); ResourceModifier rm = new ResourceModifier(value); actualTargetResource.Modify(rm); } }
//Populate the focus list within a given being private void PopulateFocusList() { ClearMenu(); if (being.focus.Count == 0) { //Create a focus token to represent the parent being (the one who's opening this menu) and set the amount of focus to howevermuch the being has FocusToken focusToken = new FocusToken(being, being, being.GetResource("FOCUS").current); //Add it to the beings focus list so it's always the first/last being.focus.Add(focusToken); for (int i = 0; i < actionManager.LIST1.Count; i++) { if (actionManager.LIST1[i].being != being) { FocusToken focusToken2 = new FocusToken(being, actionManager.LIST1[i].being, 0f); being.focus.Add(focusToken2); } } } }
public override void Use(Being target) { float damageRoll = 0; for (int i = 0; i < baseDamage; i++) { //roll 1d6 damageRoll += UnityEngine.Random.Range(1, 6); } float plModulation = actionManager.GetPowerLevelComparison(parentBeing, target); float finalDamage = 0 - (damageRoll * plModulation); //0- makes it negative because it's damage Debug.Log("base damage: " + baseDamage + " damage roll: " + damageRoll + " parentPL " + parentBeing.GetResourceValue("POWERLEVEL", 1) + " targetpl " + target.GetResourceValue("POWERLEVEL", 1) + " plmodulation: " + plModulation + " final damage" + finalDamage); Resource targetResourceInTargetBeing; targetResourceInTargetBeing = target.GetResource(targetResource); ResourceModifier rm = new ResourceModifier(finalDamage); targetResourceInTargetBeing.Modify(rm); }