Wow, you're like some modding GOD TheLopez. Well done!
Aussie.
Quick Question - Does the AI use all the features correctly?
Like I said, I will look into the AI question... honestly, I think you should merge it in and update the SDK files when I release a new version with the AI fully implemented.I was planning on merging this, but AI is pretty much a deal breaker for me.
Any forward motion on the AI? I love the concept - but won't touch modcomps that make the AI stupider.
This mod doesn't make the AI stupider, they just don't retarget the nukes at all.
I'm not sure that you understand what "stupid" means.
Perhaps you could have the AI clear all targets and re-target on specific events, a total refresh every 10 turns, when a new war starts, or when a war ends?
Does this work on mac? I put the stuff in my mods folder but all I get is the Strategic Air Command and my nukes are normal...
bool CvUnit::canNukeAt(const CvPlot* pPlot, int iX, int iY) const
{
CvPlot* pTargetPlot;
// < M.A.D. Nukes Start >
/*
int iI;
if (!canNuke(pPlot))
{
return false;
}
*/
// < M.A.D. Nukes End >
int iDistance = plotDistance(pPlot->getX_INLINE(), pPlot->getY_INLINE(), iX, iY);
if (iDistance <= nukeRange())
{
return false;
}
if (airRange() > 0 && iDistance > airRange())
{
return false;
}
pTargetPlot = GC.getMapINLINE().plotINLINE(iX, iY);
// < M.A.D. Nukes Start >
if(GC.getGameINLINE().isMADNukesEnabled() && isHuman())
{
if(pTargetPlot == plot() && isMADEnabled())
{
return true;
}
if(pTargetPlot->getPlotCity() != NULL)
{
if(pTargetPlot->getPlotCity()->getOwnerINLINE() != getOwnerINLINE())
{
return true;
}
}
}
/*
for (iI = 0; iI < MAX_TEAMS; iI++)
{
if (isNukeVictim(pTargetPlot, ((TeamTypes)iI)))
{
if (!atWar(((TeamTypes)iI), getTeam()))
{
return false;
}
}
}
*/
// < M.A.D. Nukes End >
return true;
}
Got a question for you:
Code:bool CvUnit::canNukeAt(const CvPlot* pPlot, int iX, int iY) const { CvPlot* pTargetPlot; // < M.A.D. Nukes Start > /* int iI; if (!canNuke(pPlot)) { return false; } */ // < M.A.D. Nukes End > int iDistance = plotDistance(pPlot->getX_INLINE(), pPlot->getY_INLINE(), iX, iY); if (iDistance <= nukeRange()) { return false; } if (airRange() > 0 && iDistance > airRange()) { return false; } pTargetPlot = GC.getMapINLINE().plotINLINE(iX, iY); // < M.A.D. Nukes Start > if(GC.getGameINLINE().isMADNukesEnabled() && isHuman()) { if(pTargetPlot == plot() && isMADEnabled()) { return true; } if(pTargetPlot->getPlotCity() != NULL) { if(pTargetPlot->getPlotCity()->getOwnerINLINE() != getOwnerINLINE()) { return true; } } } /* for (iI = 0; iI < MAX_TEAMS; iI++) { if (isNukeVictim(pTargetPlot, ((TeamTypes)iI))) { if (!atWar(((TeamTypes)iI), getTeam())) { return false; } } } */ // < M.A.D. Nukes End > return true; }
First, why do you remove the canNuke check? It checks that the unit has a nuke range > -1.
Then, why do you check for isHuman? Is this function doing something that should only work for humans, and not the AI?
Then, why do you check that the target plot is the same plot as the units plot? Why would nuking the spot the unit is on be acceptable?
Then, why does it check that the target city is not owned by me, and return true?
I'm totally confused at the necessity of all of these changes. Especially why it requires a human too.
Allright, I finished my remake of MAD Nukes (but for civics, not a building), and it's uploaded here. TheLopez and the BUG Mod Team have been credited, since I merged BUG 4.4 into the mod to make it easier for me to add some key features.
Specifically, the AI has been completely rewrote, and are aware of both the civics that provide MAD Nukes, and targeting cities. The AI will re-target cities when their strategies change, and work much better within the mod. I've tried to eliminate most of the python changes, so the config file was removed, along with all of the "special" devastate features, which I felt were superfluous to the goal of the mod. ALT-N still opens the Nuclear Targeting interface, and that was left unchanged, except that an icon is also present in the main interface, and allows players to view the Nuclear Targeting interface that way too. For testing purposes, Hereditary Rule ena
bles MAD Nukes, but modders can change it to use any number of civics.
Some bugs were also changed. You can only target cities that are revealed to you on the map. (Before, you could target unrevealed cities, which would allow the player to cheat and find cities they should not know exist...) Code was cleaned up, some things were moved into separate functions to eliminate Copy and Pasted sections of code.
Hopefully someone other than me finds this worthwhile.![]()