| 1084 | } |
| 1085 | |
| 1086 | bool BattleUnit::startAttackPsiInternal(GameState &state, StateRef<BattleUnit> target, |
| 1087 | PsiStatus status, StateRef<AEquipmentType> item) |
| 1088 | { |
| 1089 | if (agent->getAnimationPack()->useFiringAnimationForPsi) |
| 1090 | { |
| 1091 | setHandState(HandState::Firing); |
| 1092 | } |
| 1093 | int chance = getPsiChanceForEquipment(target, status, item); |
| 1094 | int roll = randBoundsExclusive(state.rng, 0, 100); |
| 1095 | experiencePoints.psi_attack++; |
| 1096 | experiencePoints.psi_energy++; |
| 1097 | LogWarning("Psi Attack #%d Roll %d Chance %d %s Attacker %s Target %s", (int)status, roll, |
| 1098 | chance, roll < chance ? (UString) "SUCCESS" : (UString) "FAILURE", id, target->id); |
| 1099 | if (roll >= chance) |
| 1100 | { |
| 1101 | return false; |
| 1102 | } |
| 1103 | experiencePoints.psi_attack += 2; |
| 1104 | experiencePoints.psi_energy += 2; |
| 1105 | |
| 1106 | // Attack hit, apply effects |
| 1107 | |
| 1108 | if (psiTarget) |
| 1109 | { |
| 1110 | stopAttackPsi(state); |
| 1111 | } |
| 1112 | psiTarget = target; |
| 1113 | psiStatus = status; |
| 1114 | psiItem = item; |
| 1115 | target->psiAttackers[id] = status; |
| 1116 | ticksAccumulatedToNextPsiCheck = 0; |
| 1117 | target->applyPsiAttack(state, *this, status, item, true); |
| 1118 | |
| 1119 | return true; |
| 1120 | } |
| 1121 | |
| 1122 | void BattleUnit::applyPsiAttack(GameState &state, BattleUnit &attacker, PsiStatus status, |
| 1123 | StateRef<AEquipmentType> item, bool impact) |
nothing calls this directly
no test coverage detected