public void TestCE(Zyx_Object subject) { if (subject.myCaracs.conditions.Count > 0) { string[] descrCond = subject.myCaracs.conditions[0].Split(new string[] { "%" }, System.StringSplitOptions.None); string[] descrEff = subject.myCaracs.effects[0].Split(new string[] { "%" }, System.StringSplitOptions.None); for (int j = 0; j < descrCond.Length; j += 2) { cumulative = 0; bool success = TestCond(subject, descrCond[j], System.Int32.Parse(descrCond[j + 1])); if (!descrCond[j].Contains("Cum")) { cumulative = 1; } if (success) { for (int k = 1; k <= cumulative; k++) { DoEffect(subject, descrEff[j], System.Int32.Parse(descrEff[j + 1])); } } } } }
public void BuffMinion(Zyx_Object unit, int val) { unit.myCaracs.PV += val - val / 3; foreach (string action in unit.myCaracs.actions.Keys) { unit.myCaracs.actions[action][0] += val / 3; } }
public bool AddEffect(Zyx_Object target, string eff) { if (target != null && (target.friendly != friendly) && CheckDelay(eff)) { if (new List <string>(target.myCaracs.effectsOverTime.Keys).Contains(eff)) { target.myCaracs.effectsOverTime[eff] += myCaracs.actions[eff][0]; } else { target.myCaracs.effectsOverTime.Add(eff, 1); } return(true); } return(false); }
public void DoEffect(Zyx_Object obj, string effect, int value) { switch (effect) { case ("Nbatt"): obj.myCaracs.NB_ATT++; break; case ("Rotate"): int go = (value == 8 ? 1 : (value == 4 ? 2 : 0)); obj.myOrientation = keyToCoord[(go + coordToKey[obj.myOrientation]) % 8]; obj.gameObject.GetComponent <RectTransform>().Rotate(new Vector3(0, 0, 360 / value)); break; case ("Opposite"): obj.myCaracs.tempActions.Add("Opposite"); break; case ("Att"): obj.myCaracs.ATT += value; //print(value); break; case ("AdjAtt"): foreach (Cell neighb in obj.getZone("circle", 1)) { if (!neighb.available && neighb.occupant.friendly) { neighb.occupant.myCaracs.ATT++; } } break; case ("AdjNbAtt"): foreach (Cell neighb in obj.getZone("circle", 1)) { if (!neighb.available && neighb.occupant.friendly) { neighb.occupant.myCaracs.NB_ATT++; } } break; default: break; } }
public bool TestCond(Zyx_Object obj, string test, int value) { bool result = false; int count = 0; switch (test) { case ("True"): result = true; break; case ("Support"): foreach (Cell neighb in obj.getZone("circle", 1)) { if (!neighb.available && neighb.occupant.friendly) // Attation : en vrai c'est un Wielder qu'il faut ! { count++; } } result = result || count >= value; break; case ("SupportCum"): int valueCum = value; while (TestCond(obj, "Support", valueCum)) { valueCum += value; cumulative++; } result = cumulative > 0; break; default: break; } return(result); }