[PYTHONCOM] MAD Nukes Mod

Updated to be compatible with Beyond the Sword v3.19
 
Wow, you're like some modding GOD TheLopez. Well done :)!

Aussie.
 
Wow, you're like some modding GOD TheLopez. Well done :)!

Aussie.

Lol, thanks Aussie... I have another 6 close to being ready to go... but they or on hold until I can get yours working. That is my top priority right now.
 
Wow, thank you for that. I just hope that I made the job relatively easy for you by properly indicating where the changes were :)!

Aussie.
 
Quick Question - Does the AI use all the features correctly?

Ummm... :mischief:
...
...
...

Huh, now that you mention it. I actually don't remember. I'll look into the code after I am done updating the Multi-bonus unit requirements mod
 
I was planning on merging this, but AI is pretty much a deal breaker for me.
 
I was planning on merging this, but AI is pretty much a deal breaker for me.
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.
 
The AI will never change pretargeted nukes to new targets atm.

Example: Zulu gets pretargeted. War with America begins. No nuke will fly to America. ;)
 
Any forward motion on the AI? I love the concept - but won't touch modcomps that make the AI stupider.
 
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.
 
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?
 
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?

I will look into it again when I finish rewriting the Sniper Mod.
 
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...

Sorry, no it doesn't work on a mac
 
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.
 
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.


All good questions... Honestly I don't remember. I just ported the code from warlords to BtS. We can take out the check for humans, that doesn't bother me. As for nuking in the same plot, why not... people should be allowed to be stupid right?

If you have better code I would love to put it in...
 
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 enables 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. ;)
 
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. ;)

Very cool, thanks:goodjob:
 
Top Bottom