Current version is broke (forgot to comment an import out). Don't download it.
To install: Make sure you have the latest version of Fall from Heaven. Reinstall the latest official patch. Download the attachment ffh2-014d-mods-hero.zip and extract it into the (Civilization 4 path)\Mods folder. The archive also includes diff files that include the exact changes in the source code from the official version (0.14d). Unfortunately, I couldn't package the modified editor spreadsheet because of size limits.
To uninstall: Reinstall the latest official patch. If you're updating to a new version of this mod, you should reinstall the latest official patch before installing the new version.
This patch IS compatible with 0.14 save games.
I decided to create a patch without the hero enhancements here for those that don't want the new features and want compatibility with 0.14 save games.
Changelog is cumulative with respect to the original FfH version (0.14d). Blue stuff is new. Red stuff is noted bugs or gotchas. Dark green stuff is easy fixes that don't depend on any of the internal changes I've made (that would easily be integrated into the official version). Green stuff is new easy fixes.
Changes:
Bug fixes:
Internal changes:
To install: Make sure you have the latest version of Fall from Heaven. Reinstall the latest official patch. Download the attachment ffh2-014d-mods-hero.zip and extract it into the (Civilization 4 path)\Mods folder. The archive also includes diff files that include the exact changes in the source code from the official version (0.14d). Unfortunately, I couldn't package the modified editor spreadsheet because of size limits.
To uninstall: Reinstall the latest official patch. If you're updating to a new version of this mod, you should reinstall the latest official patch before installing the new version.
This patch IS compatible with 0.14 save games.
I decided to create a patch without the hero enhancements here for those that don't want the new features and want compatibility with 0.14 save games.
Changelog is cumulative with respect to the original FfH version (0.14d). Blue stuff is new. Red stuff is noted bugs or gotchas. Dark green stuff is easy fixes that don't depend on any of the internal changes I've made (that would easily be integrated into the official version). Green stuff is new easy fixes.
Changes:
- National units can no longer be gifted to other players. Team-specific units can no longer be gifted to other teams (though I don't think FfH has any team-specific units). World units can still be gifted. This fixes the multiplayer exploit where you can keep gifting national units to your ally and vice versa.
- Bloom works over elven farms and cottages and their ilk.
Bug fixes:
- When a vampire feeds, its MPs could go into the negatives (causing odd displays like 2 out of 1 moves) - this has been fixed so that a vampire correctly loses a MP when feeding.
- When Loki runs away, the game won't display the message that the attacker withdrew. Forgot to mention that this also removed the Fear withdrawal message (and any other events in the cannotAttack function).
- Fireballs, Meteors, and Floating Eyes can no longer trigger goody huts.
- If Fireballs, Meteors, and Floating Eyes are summoned on ships, they are immediately unloaded.
- Multiple workers can be captured.
- A bunch of misc changes to message text after battles - mostly making capitalization more consistent. See CvEventManager.py.diff for details.
- A captured worker stays in its original plot if it's safe.
- Fireballs and meteors no longer capture workers.
- When a Boarding Party attacks and captures a ship, that ship stays in its original plot if its safe. Furthermore, the captured ship loads the Boarding Party.
- When successfully attacking a non-ship unit such as the Kraken or Drown, Boarding Party stays on the ship it attacked from.
- When a unit with the Taskmaster promotion or Slavery civic attacks and turns in enemy unit into a Slave, that unit stays in its original plot if it's safe.
- When a Werewolf attacks and turns an enemy unit into a Werewolf, that unit stays in its original plot if it's safe.
- An attacking Werewolf that upgrades to a higher Werewolf can advance into the plot it is attacking into.
- All animal units except the wolf can't be turned into Werewolves. The attacking Werewolf can still upgrade into a higher Werewolf though in these cases.
- When a unit with the Command promotion attacks and converts an enemy unit to your cause, that unit stays in its original plot if it's safe. Furthermore, a "A unit converts to your cause." message is displayed.
- When a unit with the Subdue Animal promotion attacks and captures an animal, that animal stays in its original plot if it's safe. Furthermore, a "Animal captured." message is displayed.
- When Magnadine attacks and converts an enemy unit to your cause, that unit stays in its original plot if it's safe. Furthermore, a "A unit converts to your cause." message is displayed.
- If a Chaos Marauder betrays you, the plot it goes to is chosen more intelligently. If the chaos marauder was alone, it stays in the same plot. Furthermore, a "A unit turns against you." message is displayed.
- A unit defecting to the Cult of the Dragon chooses the plot it goes to more intelligently. If the defecting unit was alone, it stays in the same plot. Otherwise, it goes to a friendly, team, or neutral plot, in that order of preference.
- Loki can escape into ships or into plots with only neutral units.
- Loki's attacker moves into the plot Loki was just at, using the correct amount of movement points and retaining the selection group. Fixed a bug in previous patch that could prevent this from happening if a player controls Loki and Loki is attacked.
Internal changes:
- [*]Added fireEventListeners function to CvEventManager and CvEventInterface. This function fires all listeners on a specified event and removes them unless those listeners return False.
[*]Added addEventListener to CvEventInterface that simply calls CvEventManager's addEventListener. Added getGlobals() to the CvEventManager class that returns CvEventManager's globals. This allows modules to import CvEventInterface and access anything in CvEventManager.
- Added a FFHMoveGroup function that moves a group or the selection group to the specified adjacent plot. Movement cost is considered (MPs are subtracted), and the selection group is retained if it's the group being moved. Added an optional argument that specifies units in the group to ignore and not move.
- Added a onAfterPlayerTurns event that occurs after all onEndPlayerTurn events for the turn and, more importantly, after all the units are updated for the turn. This means that this event happens after units heal up, have their MPs reset, etc. Implementated via a hack in CvGameInterface.isVictoryTest().
- Withdraw and combat result messages "moved out" of the SDK (by adding blank entries for them in CIV4GameText_FFH2.xml) and are now manually displayed in CvEventManager. This allows CvEventManager to control when, if, and how to show the messages. Causes withdraw messages to appear erroneously when quick combat is enabled. Has been fixed in unreleased dev version.
- Readded the FFH*CustomData functions from a previous version to PyUnit as getData/delData/setData.
- Removed change since I found a better way: CvEventManager derives from Borg. This allows usage of CvEventManager in CustomFunctions and CvGameInterface, without having to import CvEventInterface or CvFFHSpellsEventManager and without worrying about import order.
- CustomFunctions derives from Singleton. May save a bit of memory and time.
- Added a Borg "abstract" class to CvUtil. A Borg subclass and any subclasses of that class will share the same data. Unlike Singletons, each instance is not equivalent to each other (pointer-wise); they just share the same data. The downside is that each Borg instance takes a bit more time to instantiate than Singletons. (Google "python borg" for more info.)
- Added a Singleton "abstract" class to CvUtil. A Singleton subclass will have only a single instance no matter how many times its constructor is called, unless the module that class is in is reloaded.
- Made onBeginPlayerTurn's iPlayer and onBeginGameTurn's iGameTurn global vars so they can be accessed outside the module.
- Changed initialization of the global CvEventManager.iLastPlayer to just -1 (don't know why it was set to a one-element array), and added "global iLastPlayer" to onBeginPlayerTurn so that it really does reflect the last player.
- Heavily modified FFHConvert and factored in the previous conversion changes. Namely: Captured units can stay in their original plots if it's safe (i.e. the attacker moves into the plot after combat). FFHConvert has been split into FFHConvertWinner, FFHConvertLoser, and FFHConvert: the former two for use in onCombatResult, and latter one for generic conversions. See FFHConvertLoser for details. Update to the conversion code: only use listeners when the unit to be converted will stay in its original plot.
- Implemented a listener system that allows you to hook up functions to an event, so that whenever that event is fired, the hooked up functions run and then unhook themselves (unless they return False) before the actual event handler runs. This makes the FFH*CustomData system obsolete, since it's much cleaner and probably faster. Find self.addEventListener in CvEventManager.py and look at the comment above it to see how to use it.
- Added pAttacker and pDefender in onCombatResult.
- Added FFHIsSafePlot function. Has the ability to ignore specified units. Called by FFHFindSafePlot.
- New class called PyHelpers.PyUnit that acts as wrapper around CyUnit and can store the unit's state even when the wrapped CyUnit instance becomes invalid (but the data isn't retained between saves/loads). This class can be used to converts units to enemy units (which is its original purpose). Supports some default arguments for certain CyUnit methods. Can be used to serialize a unit's state into a string. Can act as an extension point for more convenience methods. Look at the source docstring for more info.
- Branched FFHFindClearPlot into FFHFindSafePlot and changed the function signature of both. Loki code and several other places now call FFHFindSafePlot instead of FFHFindClearPlot. FFHFindSafePlot has the ability to choose preferred plots and ignore specified units.