| 1 |
from macros.misc import PLANET_SHIELD_FACTOR |
| 2 |
from macros.priorities import ( |
| 3 |
AFTER_ALL_TARGET_MAX_METERS_PRIORITY, |
| 4 |
TARGET_AFTER_2ND_SCALING_PRIORITY, |
| 5 |
) |
| 6 |
|
| 7 |
# // param1: value |
| 8 |
# NATIVE_PLANETARY_SHIELDS |
| 9 |
# '''EffectsGroup |
| 10 |
# scope = Source |
| 11 |
# activation = And [ |
| 12 |
# Planet |
| 13 |
# Unowned |
| 14 |
# ] |
| 15 |
# accountinglabel = "NATIVE_PLANETARY_SHIELDS_LABEL" |
| 16 |
# effects = SetMaxShield value = Value + ( @1@ ) |
| 17 |
# ''' |
| 18 |
|
| 19 |
try: |
| 20 |
from focs._effects import ( |
| 21 |
CurrentTurn, |
| 22 |
EffectsGroup, |
| 23 |
Focus, |
| 24 |
IsSource, |
| 25 |
LocalCandidate, |
| 26 |
MinOf, |
| 27 |
Planet, |
| 28 |
SetMaxShield, |
| 29 |
SetShield, |
| 30 |
Target, |
| 31 |
Unowned, |
| 32 |
Value, |
| 33 |
) |
| 34 |
except ModuleNotFoundError: |
| 35 |
pass |
| 36 |
|
| 37 |
STANDARD_SHIELD_GROWTH = EffectsGroup( # increase 1 per turn, up to max |
| 38 |
scope=IsSource, |
| 39 |
activation=Planet() |
| 40 |
& Unowned |
| 41 |
& (LocalCandidate.LastTurnConquered < CurrentTurn) |
| 42 |
& (LocalCandidate.LastTurnAttackedByShip < CurrentTurn), |
| 43 |
accountinglabel="DEF_ROOT_DEFENSE", |
| 44 |
priority=AFTER_ALL_TARGET_MAX_METERS_PRIORITY, |
| 45 |
effects=SetShield(value=MinOf(float, Value(Target.MaxShield), Value + PLANET_SHIELD_FACTOR)), |
| 46 |
) |
| 47 |
|
| 48 |
|
| 49 |
PROTECTION_FOCUS_SHIELDS = EffectsGroup( |
| 50 |
scope=IsSource, |
| 51 |
activation=Planet() & Focus(type=["FOCUS_PROTECTION"]), |
| 52 |
stackinggroup="FOCUS_PROTECTION_SHIELDS_STACK", |
| 53 |
accountinglabel="FOCUS_PROTECTION_LABEL", |
| 54 |
priority=TARGET_AFTER_2ND_SCALING_PRIORITY, |
| 55 |
effects=SetMaxShield(value=Value * 2), |
| 56 |
) |
| 57 |
|
| 58 |
|
| 59 |
AVERAGE_PLANETARY_SHIELDS = [PROTECTION_FOCUS_SHIELDS, STANDARD_SHIELD_GROWTH] |
| 60 |
|
| 61 |
# #include "../macros/priorities.macros" |
| 62 |
# #include "../macros/misc.macros" |