private void ModifyAbilityModifier(PerkAbilityModifier modifier, Perk perk) { //modifier.duration+=perk.abDurationMod; modifier.cost += perk.abCostMod; modifier.cooldown += perk.abCooldownMod; modifier.useLimit += perk.abUseLimitMod; modifier.hitChance += perk.abHitChanceMod; modifier.range += perk.abRangeMod; modifier.aoeRange += perk.abAOERangeMod; modifier.HP += perk.abHPMod; modifier.AP += perk.abAPMod; modifier.effectDuration += perk.abDurationMod; ModifyUnitStats(modifier.stats, perk.stats); }
private void ModifyFactionAbilityModifier(PerkAbilityModifier abilityModifier, Perk perk) { ModifyAbilityModifier(abilityModifier, perk); //ModifyUnitStats(abilityModifier.stats, perk.stats); }
public string _PurchasePerk(Perk perk, bool useCurrency = true) { string text = perk.Purchase(useCurrency); if (text != "") { return(text); } SavePerkProgress(); TBTK.OnPerkPurchased(perk); //process the prereq for other perk for (int i = 0; i < perkList.Count; i++) { Perk perkTemp = perkList[i]; if (perkTemp.purchased || perkTemp.prereq.Count == 0) { continue; } perkTemp.prereq.Remove(perk.prefabID); } perkPoint += 1; TBTK.OnPerkPoint(perkPoint); if (perk.type == _PerkType.NewUnitAbility) { if (perk.addAbilityToAllUnit) { AbilityManagerUnit.PerkUnlockNewAbility(null, perk.newUnitAbilityID, perk.subUnitAbilityID); globalUnitModifier.abilityIDList.Add(perk.newUnitAbilityID); globalUnitModifier.abilityXIDList.Add(perk.subUnitAbilityID); } else { AbilityManagerUnit.PerkUnlockNewAbility(perk.newABUnitIDList, perk.newUnitAbilityID, perk.subUnitAbilityID); for (int i = 0; i < perk.newABUnitIDList.Count; i++) { int index = UnitModifierExist(perk.newABUnitIDList[i]); if (index == -1) { PerkUnitModifier unitModifier = new PerkUnitModifier(); unitModifier.prefabID = perk.newABUnitIDList[i]; unitModifierList.Add(unitModifier); index = unitModifierList.Count - 1; } unitModifierList[index].abilityIDList.Add(perk.newUnitAbilityID); unitModifierList[index].abilityXIDList.Add(perk.subUnitAbilityID); } } } else if (perk.type == _PerkType.NewFactionAbility) { AbilityManagerFaction.PerkUnlockNewAbility(perk.newFacAbilityID, perk.subFacAbilityID); factionAbilityIDList.Add(perk.newFacAbilityID); factionAbilityXIDList.Add(perk.subFacAbilityID); } else if (perk.type == _PerkType.Unit) { for (int i = 0; i < perk.unitIDList.Count; i++) { int index = UnitModifierExist(perk.unitIDList[i]); if (index == -1) { PerkUnitModifier unitModifier = new PerkUnitModifier(); unitModifier.prefabID = perk.unitIDList[i]; unitModifierList.Add(unitModifier); index = unitModifierList.Count - 1; } ModifyUnitModifierInList(index, perk); } } else if (perk.type == _PerkType.Unit_All) { ModifyUnitModifier(globalUnitModifier, perk); } else if (perk.type == _PerkType.UnitAbility) { for (int i = 0; i < perk.unitAbilityIDList.Count; i++) { int index = UnitAbilityModifierExist(perk.unitAbilityIDList[i]); if (index == -1) { PerkAbilityModifier abilityModifier = new PerkAbilityModifier(); abilityModifier.prefabID = perk.unitAbilityIDList[i]; unitAbilityModifierList.Add(abilityModifier); index = unitAbilityModifierList.Count - 1; } ModifyUnitAbilityModifierInList(index, perk); } } else if (perk.type == _PerkType.UnitAbility_All) { ModifyUnitAbilityModifier(globalUnitAbilityModifier, perk); } else if (perk.type == _PerkType.FactionAbility) { for (int i = 0; i < perk.facAbilityIDList.Count; i++) { int index = FactionAbilityModifierExist(perk.facAbilityIDList[i]); if (index == -1) { PerkAbilityModifier abilityModifier = new PerkAbilityModifier(); abilityModifier.prefabID = perk.facAbilityIDList[i]; factionAbilityModifierList.Add(abilityModifier); index = factionAbilityModifierList.Count - 1; } ModifyFactionAbilityModifierInList(index, perk); } } else if (perk.type == _PerkType.FactionAbility_All) { ModifyFactionAbilityModifier(globalFactionAbilityModifier, perk); } return(""); }