- edited description
Pillar of Fire and Crush can target invisible units
Issue #116
resolved
This should be reported to MNAI along with a fix.
Comments (3)
-
reporter -
reporter The following code prevents Pillar of Fire and Crush from targetting hidden plots. It also prevents invisible units from being taken into account when choosing the target plot (but they will still suffer damage if they are in the tile).
def reqPillarofFire(caster): iX = caster.getX() iY = caster.getY() pPlayer = gc.getPlayer(caster.getOwner()) iTeam = pPlayer.getTeam() eTeam = gc.getTeam(iTeam) for iiX in range(iX-2, iX+3, 1): for iiY in range(iY-2, iY+3, 1): pPlot = CyMap().plot(iiX,iiY) if pPlot.isVisible(iTeam, False): bEnemy = False bNeutral = False for i in range(pPlot.getNumUnits()): pUnit = pPlot.getUnit(i) if not pUnit.isInvisible(iTeam, False): if eTeam.isAtWar(pUnit.getTeam()): bEnemy = True else: bNeutral = True if (bEnemy and not bNeutral): return True return false def spellPillarofFire(caster): iX = caster.getX() iY = caster.getY() pPlayer = gc.getPlayer(caster.getOwner()) iTeam = pPlayer.getTeam() eTeam = gc.getTeam(iTeam) iBestValue = 0 pBestPlot = -1 for iiX in range(iX-2, iX+3, 1): for iiY in range(iY-2, iY+3, 1): bNeutral = False iValue = 0 pPlot = CyMap().plot(iiX,iiY) if pPlot.isVisible(iTeam, False): for i in range(pPlot.getNumUnits()): pUnit = pPlot.getUnit(i) if not pUnit.isInvisible(iTeam, False): if eTeam.isAtWar(pUnit.getTeam()): iValue += 5 * pUnit.baseCombatStr() else: bNeutral = True if (iValue > iBestValue and not bNeutral): iBestValue = iValue pBestPlot = pPlot if pBestPlot != -1: for i in range(pBestPlot.getNumUnits()): pUnit = pBestPlot.getUnit(i) pUnit.doDamage(50, 75, caster, gc.getInfoTypeForString('DAMAGE_FIRE'), True) if (pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_FOREST') or pPlot.getFeatureType() == gc.getInfoTypeForString('FEATURE_JUNGLE')): bValid = True iImprovement = pPlot.getImprovementType() if iImprovement != -1 : if gc.getImprovementInfo(iImprovement).isPermanent(): bValid = False if bValid: if CyGame().getSorenRandNum(100, "Flames Spread") < gc.getDefineINT('FLAMES_SPREAD_CHANCE'): pPlot.setImprovementType(gc.getInfoTypeForString('IMPROVEMENT_SMOKE')) CyEngine().triggerEffect(gc.getInfoTypeForString('EFFECT_PILLAR_OF_FIRE'),pBestPlot.getPoint()) def reqCrush(caster): iX = caster.getX() iY = caster.getY() pPlayer = gc.getPlayer(caster.getOwner()) iTeam = pPlayer.getTeam() eTeam = gc.getTeam(iTeam) for iiX in range(iX-2, iX+3, 1): for iiY in range(iY-2, iY+3, 1): pPlot = CyMap().plot(iiX,iiY) if pPlot.isVisible(iTeam, False): bEnemy = False bNeutral = False for i in range(pPlot.getNumUnits()): pUnit = pPlot.getUnit(i) if not pUnit.isInvisible(iTeam, False): if eTeam.isAtWar(pUnit.getTeam()): bEnemy = True else: bNeutral = True if (bEnemy and not bNeutral): return True return False def spellCrush(caster): iX = caster.getX() iY = caster.getY() pPlayer = gc.getPlayer(caster.getOwner()) iTeam = pPlayer.getTeam() eTeam = gc.getTeam(iTeam) iBestValue = 0 pBestPlot = -1 for iiX in range(iX-2, iX+3, 1): for iiY in range(iY-2, iY+3, 1): bNeutral = False iValue = 0 pPlot = CyMap().plot(iiX,iiY) if pPlot.isVisible(iTeam, False): for i in range(pPlot.getNumUnits()): pUnit = pPlot.getUnit(i) if not pUnit.isInvisible(iTeam, False): if eTeam.isAtWar(pUnit.getTeam()): iValue = iValue + 10 else: bNeutral = True if (iValue > iBestValue and not bNeutral): iBestValue = iValue pBestPlot = pPlot if pBestPlot != -1: for i in range(pBestPlot.getNumUnits()): pUnit = pBestPlot.getUnit(i) pUnit.doDamage(50, 75, caster, gc.getInfoTypeForString('DAMAGE_PHYSICAL'), True) CyEngine().triggerEffect(gc.getInfoTypeForString('EFFECT_CRUSH'),pBestPlot.getPoint())
-
reporter - changed status to resolved
- Log in to comment