public Tip GetRandTipConcerningGroups(GroupMonsterFighter groupMonster, GroupHumanFighter groupHuman) { List <Tip> lFinalTips = GetAllTipConcerningGroups(groupMonster, groupHuman, true); if (lFinalTips.Count == 0) { return(null); } int randIndex = Random.Range(0, lFinalTips.Count); Tip tip = lFinalTips[randIndex]; LearnTip(tip); return(tip); }
public List <Tip> GetAllTipConcerningGroups(GroupMonsterFighter groupMonster, GroupHumanFighter groupHuman, bool inInitialGroup) { List <Tip> finalList = new List <Tip>(); List <Fighter> allHuman = groupHuman.lFighters; List <Fighter> allMonster = groupMonster.lFighters; if (inInitialGroup) { allHuman = groupHuman.lInitialFighters; allMonster = groupMonster.lInitialFighters; } foreach (Tip tip in tipsNotKnownByPlayer) { bool bConcernM = false; bool bConcernH = false; foreach (Fighter fighter in allHuman) { ModelHumainUI modelH = ((Human)fighter).currentUI.gameObject.GetComponentInChildren <ModelHumainUI>(); CaractHumainCheveux cheveux = modelH.caractCheveux; CaractHumainStuff stuff = modelH.caractStuff; if (tip.caracHumain == cheveux) { bConcernH = true; } else if (tip.caracHumain == stuff) { bConcernH = true; } } foreach (Fighter fighter in allMonster) { ModelMonsterUI modelM = ((Monster)fighter).currentUI.gameObject.GetComponentInChildren <ModelMonsterUI>(); if (modelM != null) { CaractMonster firstMutation = modelM.caractMonster; CaractMonster permaMutation = modelM.permanentCarMutation; if (tip.caracMonster == firstMutation) { bConcernM = true; } else if (tip.caracMonster == permaMutation) { bConcernM = true; } } } if (bConcernH && bConcernM) { finalList.Add(tip); } } return(finalList); }
public float GetBonus(ActionType actionType, Human human, GroupMonsterFighter groupMonster) { float bonus = 0; List <Tip> myTips = GetTipsOfAction(actionType, human.eCreatureType); CaractHumainCheveux chm = human.currentUI.gameObject.GetComponentInChildren <ModelHumainUI>().caractCheveux; myTips = GetTipsAboutHumainCarac(chm, myTips); foreach (Fighter fighter in groupMonster.lFighters) { if (fighter.CanAttack()) { ModelMonsterUI modelM = ((Monster)fighter).currentUI.gameObject.GetComponentInChildren <ModelMonsterUI>(); if (modelM != null) { CaractMonster tempCarac = modelM.caractMonster; CaractMonster permaCarac = modelM.permanentCarMutation; foreach (Tip tip in myTips) { if (tip.caracMonster == tempCarac) { bonus += tip.modroll.GetValueOfAction(actionType, human.eCreatureType); } else if (tip.caracMonster == permaCarac) { bonus += tip.modroll.GetValueOfAction(actionType, human.eCreatureType); } if (bonus != 0) { break; } } } } if (bonus != 0) { break; } } myTips = GetTipsOfAction(actionType, human.eCreatureType); CaractHumainStuff chs = human.currentUI.gameObject.GetComponentInChildren <ModelHumainUI>().caractStuff; myTips = GetTipsAboutHumainCarac(chs, myTips); foreach (Fighter fighter in groupMonster.lFighters) { if (fighter.CanAttack()) { ModelMonsterUI modelM = ((Monster)fighter).currentUI.gameObject.GetComponentInChildren <ModelMonsterUI>(); if (modelM != null) { CaractMonster tempCarac = modelM.caractMonster; CaractMonster permaCarac = modelM.permanentCarMutation; foreach (Tip tip in myTips) { if (tip.caracMonster == tempCarac) { bonus += tip.modroll.GetValueOfAction(actionType, human.eCreatureType); } else if (tip.caracMonster == permaCarac) { bonus += tip.modroll.GetValueOfAction(actionType, human.eCreatureType); } if (bonus != 0) { break; } } } } if (bonus != 0) { break; } } // CaractMonster mutation; return(bonus); }