| 122 | } |
| 123 | |
| 124 | void AnimExt::VeinAttackAI(AnimClass* pAnim) |
| 125 | { |
| 126 | CellStruct pCoordinates = pAnim->GetMapCoords(); |
| 127 | CellClass* pCell = MapClass::Instance.GetCellAt(pCoordinates); |
| 128 | ObjectClass* pOccupier = pCell->FirstObject; |
| 129 | constexpr unsigned char fullyFlownWeedStart = 0x30; // Weeds starting from this overlay frame are fully grown |
| 130 | constexpr unsigned int weedOverlayIndex = 126; |
| 131 | |
| 132 | if (!pOccupier || pOccupier->GetHeight() > 0 || pCell->OverlayTypeIndex != weedOverlayIndex |
| 133 | || pCell->OverlayData < fullyFlownWeedStart || pCell->SlopeIndex) |
| 134 | { |
| 135 | pAnim->UnableToContinue = true; |
| 136 | } |
| 137 | |
| 138 | if (Unsorted::CurrentFrame % 2 == 0) |
| 139 | { |
| 140 | while (pOccupier != nullptr) |
| 141 | { |
| 142 | ObjectClass* pNext = pOccupier->NextObject; |
| 143 | int damage = RulesClass::Instance->VeinDamage; |
| 144 | TechnoClass* pTechno = abstract_cast<TechnoClass*, true>(pOccupier); |
| 145 | |
| 146 | if (pTechno && !pTechno->GetTechnoType()->ImmuneToVeins && !pTechno->HasAbility(Ability::VeinProof) |
| 147 | && pTechno->Health > 0 && pTechno->IsAlive && pTechno->GetHeight() <= 5) |
| 148 | { |
| 149 | pTechno->ReceiveDamage(&damage, 0, RulesExt::Global()->VeinholeWarhead, nullptr, false, false, nullptr); |
| 150 | } |
| 151 | |
| 152 | pOccupier = pNext; |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | // Changes type of anim in similar fashion to Next. |
| 158 | void AnimExt::ChangeAnimType(AnimClass* pAnim, AnimTypeClass* pNewType, bool resetLoops, bool restart) |
nothing calls this directly
no test coverage detected