| 1 |
from focs._effects import ( |
| 2 |
Capital, |
| 3 |
EffectsGroup, |
| 4 |
GameRule, |
| 5 |
HasSpecies, |
| 6 |
LocalCandidate, |
| 7 |
MaxOf, |
| 8 |
MinOf, |
| 9 |
Planet, |
| 10 |
Population, |
| 11 |
SetSpeciesOpinion, |
| 12 |
SetSpeciesTargetOpinion, |
| 13 |
SpeciesEmpireTargetOpinion, |
| 14 |
SpeciesShipsDestroyed, |
| 15 |
SpeciesShipsLost, |
| 16 |
StatisticCount, |
| 17 |
Target, |
| 18 |
ThisSpecies, |
| 19 |
Value, |
| 20 |
) |
| 21 |
|
| 22 |
|
| 23 |
def FIXED_OPINION_EFFECTS(name: str, value: float): |
| 24 |
return EffectsGroup( |
| 25 |
scope=Capital, |
| 26 |
stackinggroup="%s_FIXED_OPINION_OF_EMPIRE" % name, |
| 27 |
effects=[ |
| 28 |
SetSpeciesTargetOpinion(species=ThisSpecies, empire=Target.Owner, opinion=value), |
| 29 |
SetSpeciesOpinion(species=ThisSpecies, empire=Target.Owner, opinion=value), |
| 30 |
], |
| 31 |
) |
| 32 |
|
| 33 |
|
| 34 |
def COMMON_OPINION_EFFECTS(name: str): |
| 35 |
return EffectsGroup( |
| 36 |
scope=Capital, |
| 37 |
stackinggroup="%s_TOWARDS_TARGET_OPINION_OF_EMPIRE" % name, |
| 38 |
effects=[ |
| 39 |
SetSpeciesTargetOpinion( # baseline opinion |
| 40 |
species=ThisSpecies, |
| 41 |
empire=Target.Owner, |
| 42 |
opinion=Value |
| 43 |
+ GameRule(type=float, name="RULE_BASELINE_SPECIES_EMPIRE_OPINION") |
| 44 |
+ ( |
| 45 |
GameRule(type=float, name="RULE_INVASION_OPINION_PENALTY_SCALING") |
| 46 |
* StatisticCount( |
| 47 |
float, |
| 48 |
condition=Planet() |
| 49 |
& HasSpecies(name=[ThisSpecies]) |
| 50 |
& (LocalCandidate.LastInvadedByEmpire == Target.Owner), |
| 51 |
) |
| 52 |
** 0.5 |
| 53 |
) |
| 54 |
+ ( |
| 55 |
GameRule(type=float, name="RULE_SHIPS_LOST_DESTROYED_PENALTY_SCALING") |
| 56 |
* ( |
| 57 |
SpeciesShipsDestroyed(empire=Target.Owner, name=ThisSpecies) |
| 58 |
+ SpeciesShipsLost(empire=Target.Owner, name=ThisSpecies) |
| 59 |
) |
| 60 |
** 0.5 |
| 61 |
) |
| 62 |
+ ( |
| 63 |
GameRule(type=float, name="RULE_COLONIES_FOUNDED_BONUS_SCALING") |
| 64 |
* StatisticCount( |
| 65 |
float, |
| 66 |
condition=Planet() |
| 67 |
& HasSpecies(name=[ThisSpecies]) |
| 68 |
& Population(low=0.001) |
| 69 |
& (LocalCandidate.LastColonizedByEmpire == Target.Owner), |
| 70 |
) |
| 71 |
), |
| 72 |
), |
| 73 |
SetSpeciesOpinion( |
| 74 |
species=ThisSpecies, |
| 75 |
empire=Target.Owner, |
| 76 |
opinion=Value |
| 77 |
+ MinOf( |
| 78 |
float, |
| 79 |
1.0, # increase by 1 per turn up towards target |
| 80 |
MaxOf( |
| 81 |
float, |
| 82 |
-1.0, # decrease by 1 per turn down towards target |
| 83 |
SpeciesEmpireTargetOpinion(species=ThisSpecies, empire=Target.Owner) - Value, |
| 84 |
), |
| 85 |
), |
| 86 |
), |
| 87 |
], |
| 88 |
) |