-- Readme
-- Author: Typhlomence (thread at CivFanatics: http://forums.civfanatics.com/showthread.php?t=528199)
-- DateCreated: 3/7/2017 9:43:23 PM
--------------------------------------------------------------

April Fools' Day? That's the 24th of April, right *looks at Culture Japan from the previous year*?

This mod adds a civilization based on the final boss of 100% Orange Juice, Tomomo! This civilization has a light focus on warring with other civilizations, but otherwise her abilities are a bit random and somewhat adaptable as a result. As another release that was meant to be on April Fools' Day, this is again a bit of a joke civ, and the abilities reflect that. And yes, the AI Tomomo has altered her chances to ensure victory! (Though you can turn that off in the mod options.)

This mod requries Brave New World. It also includes compatibility with:
	- Ryoga's Unique Cultural Influence
	- JFD's Cultural Diversity (Oriental, uses the same as vanilla China.)
	- JFD's Rise to Power
	- Bingles' Civ IV Leader Traits (Aggressive and Protectice)
	- JFD's Exploration Continued Expanded*
	- Hazel's Map Labels
	- Vicevirtuoso's Wish for the World*
	- JFD's and Pouakai's Mercenaries
	- JFD's Cities in Development
	- Ethnic Units / R.E.D. Modpack (Chinese units)
	- Enlightenment Era*
	- Randomized Unique Components, and Traits**
	- Community Patch/Various Mod Components
* No specific support, but should work fine
** Untested

Mod options can be changed via the TomomoOptions.sql file. The options that can be changed are:
- Changing the behaviour of the Binding Chain random promotion to the pre-release behaviour of *always* preventing enemy units from performing an action, rather than not being able to do so on consecutive turns;
- The number of turns (1-4) that a specific Marie Poppo unit has to wait until performing another steal;
- The maximum number of steals a single player can perform with all of their Marie Poppo units a turn;
- Whether Tomomo players should have greater chances for beneficial effects to occur from RNG. To mimic the original game, only AI Tomomos get "rigged dice" by default, but this can be turned off, given to player Tomomos or *any* Tomomo players;
- Whether the included soundtrack can be overriden by other mods that change soundtracks, such as Cultural Diversity.

If you encounter any issues, please enable logging (http://forums.civfanatics.com/showthread.php?t=487482), and set the "bDebug" variable in any Lua files in the mod that have it to "true", and let me know if any Lua errors occur.

Also, I'd like to give a huge thanks to my good friend YukiMisaki - he was the one who graciously drew the art for Tomomo in her leader screen (which was also used for the Dawn of Man image and leader icon). You can find some more of his work here: http://verniymisaki.deviantart.com/

UA: Magical Massacre - At the outbreak of war with a major Civilization, all units get a 50% bonus to Combat Strength for 2 turns. Enemy units near a city you capture, or one of your cities that is captured will sustain damage.
	- The strength boost affects both Melee and Ranged Combat Strength for all combat units.
	- The boost will last for two of the Tomomo player's turns, regardless of whether she declares war on her turn, or war is declared on her by another player on their turn.
	- The damage caused by captured cities is 33 damage to units adjacent to the city, 22 damage to units two tiles away, and 11 damage to units three tiles away. It applies to any units that belong to a player at war with that Tomomo, not just the one that captured a city or had their city captured. This ability cannot kill units outright.
	
UU: Marie Poppo (Scout) - Weaker than the unit it replaces, but has double the speed, ignores enemy Zone of Control, and has a 75% boost to Combat Strength when defending. It also has a chance to steal Gold, Promotions, HP and Technologies from units it passes. Can be upgraded to either a Melee or Ranged combat unit at Industrialization, and does not obsolete.
	- Specifics of stealing:
		- The chance of stealing a Technology is 1/8, and the chance of stealing a promotion or HP is 1/3 if the unit is adjacent to a military unit - each alternative is also a 1/2 chance, though only promotions from land units may be stolen. Otherwise, a Marie Poppo will attempt to steal Gold.
			- If a Marie Poppo attempts to steal a Technology you do not yet own, it will prioritise the prerequisite for the unit it is stealing from, otherwise it picks one from random. It can only steal technologies you are currently capable of researching, however.
			- A Marie Poppo will only attempt to steal HP if it is currently damaged, and it can steal up to 25 HP. It will not lower the target unit's HP to below 10.
			- Not every promotion can be stolen. For example, a Marie Poppo will never steal a promotion that allows Embarkation, allows units to Paradrop, or allows units to travel over any terrain. It can also steal promotions that would be useless or have a detrimental effect, such as promotions affecting Ranged attacks or the decreased sight that early Siege units have.
			- The amount of Gold to be stolen is ten times the target unit's level, or 20% of the unit owner's Gold, whichever is smaller.
		- Any kind of successful steal will cause the owner of the target unit to be annoyed at you, and will also award the Marie Poppo with experience.
		- Once a Marie Poppo steals something, it will not be able to steal again for four turns, and a player can only have up to four Marie Poppos steal something in a single turn.
		- If the Barbarians get a Marie Poppo somehow, it will not steal anything.
		- Finally, a Marie Poppo will not attempt to steal from your own units, units of civilizations on the same team or with a Declaration of Friendship, or friendly City States.
	- When using Whoward69's Various Mod Components or the Community Patch, Marie Poppo and Marie Poppo (Mixed) will have 75 extra HP instead of 75% extra defense strength.

UU2: Marie Poppo (Mixed) - A standalone unit at Industralization, slightly weaker than the Gatling Gun in both Melee and Ranged Strength (if the Ranged version is selected), and its Combat Strength increases in later eras. While its speed is 3 rather than 4, it still keeps the base unit's abillity to ignore Zone of Control and its increased Defense Strength. When on a flat tile, it can also build a Subspace Tunnel to return to a random city or Warp Panel in the owner's territory.
	- The Subspace Tunnel's effect will only activate if there is a free Warp Panel or City for the unit to warp to (i.e. it would be able to enter the tile under normal circumstances). As it is an Improvement internally, Marie Poppo (Mixed) will still build it to no effect, however.
	- The strength increase per era is done via promotion and is 75% for Modern, Atomic and Information Eras (i.e. a total of 225% once you get to the Information Era).
	- Marie Poppo (Mixed) will keep all promotions, except the base unit's Ubiquitous promotion that allows it to steal. This includes promotions that normally would not be kept on upgrade.
	- If playing a multiplayer game, due to limitations, the selection of Melee or Ranged Marie Poppo (Mixed) will be automatic and tied to the unit's current promotions.
	
UI: Game Board Panel - A unique Improvement that is divded up into six sub-types, and can be constructed on any flat land or coast tile at Engineering. Each type cannot be built adjacent to each other. Each Panel produces 1 Culture and 1 in another yield, with the Culture yield doubled at Industrialization. They all also have a different effect when a unit starts its turn on the tile.
	- Only one unit per player can activate a specific Panel's effects in the same turn.
	- Sub-type yields and unit effects:
		- Bonus Panel (Yellow): 1 Gold. Gives Gold equal to the unit's level to the owner as long as the owner of the unit is not at war with the owner of the Panel.
			- The gold given from units is not counted towards GPT calculations.
		- Draw Panel (Green): 1 Food. Gives either a random promotion or activates a trap.
			- If the unit of the owner, or a civilization/City State that is friends or teammates with the owner activates the Panel's effect, it will always be a promotion. If they are at war, it will always be a trap. Otherwise, it is a 1/2 chance of a promotion or trap. Traps with negative effects will incur a diplomatic penalty with the unit's owner.
			- Promotions are available to all military units, whether they be land, naval or air. Aircraft must be based on a Carrier on a Draw Panel to get the promotion (therefore you must base a Bomber on a Carrier before upgrading it to be able to have a Stealth Bomber with the promotions).
			- The actual promotion will be revealed when the unit enters combat the first time, like the Indonesian Kris Swordsman.
		- Drop Panel (Blue): 1 Science. Takes Gold equal to the unit's level from the owner. If the owner or one of their friends or teammates activates the effect, half of the lost Gold will be given back as Science. Neutral and enemy civilizations will be annoyed if their unit activates this effect.
			- The gold lost from units is not counted towards GPT calculations.
		- Encounter Panel (Red) 1 Production. Will spawn a Barbarian unit in a free adjacent tile that provides a large amount of Gold when destroyed. Golden Ages increase the strength of and Gold from the unit, and if activated by a unit at war with the Panel's owner, it will be even stronger and gives even more Gold again.
			- The unit spawned will be the strongest Archery class unit the Panel's owner can currently build, or the strongest Siege unit if the owner is in a Golden Age. if the Panel is on a coast tile, it will instead spawn a ranged Naval unit.
				- In an otherwise vanilla game, since the Galleass is a Renaissance Era unit, for gameplay reasons Encounter Panels on the coast will spawn Byzantine Dromons if Compass is not researched, even if the Panel's owner is not the Byzantines.
			- There is a delay of three turns before a new Barbarian unit may be spawned from a specific Encounter Panel.
			- Barbarians themselves will not spawn a new unit when on this Panel.
			- When using Whoward69's Various Mod Components or the Community Patch, any unit spawned from an Encounter Panel will be unable to move, though it can still attack.
		- Roll and Move Panel (Cyan): 1 Faith. All units belonging to the same player on the Panel at the start of the turn will get between 1 and 6 extra movement points. Players at war with the Panel's owner instead have their movement reduced by the same amount.
		- Warp Panel (Purple): 1 Culture. Will warp a unit to a random Warp Panel in the owner's territory, as long as there is at least one other free Warp Panel.
			- Units will only warp to Warp Panels on land/water if the starting Warp Panel is on land/water, so (for example) naval units will not get stuck on the land if they start their turn on a Warp Panel.
	- As internally, the land and coast panels are different improvements, you can build ones of the same type next to each other if it's across a land-water border. Panels on the Coast may be built by both Workers and Work Boats (and do not consume the unit), but only Work Boats can repair them.

Peace Diplomacy Track:	Final Episode Theme (100% Orance Juice)
War Diplomacy Track:	Tomomo's Theme (100% Orance Juice)

Also includes the following music tracks, all from 100% Orance Juice:
- Aru's Theme
- Fernet's Theme
- Hime's Theme
- Kai's Theme
- Marc's Theme
- Marie Poppo's Theme
- Peat's Theme
- QP's Theme
- Sora's Theme
- Suguri's Theme
- Yuki's Theme

Change Notes:
1 (25/04/2017)
	- Initial version

Notes:
- Yes, savvy players will notice that Marie Poppo's model uses a retextured version of Plutia's head. :P
- Specifics on Panel mechanics:
	- Draw Panel promotions (note that "Archery" refers to any ranged, non-siege land unit):
		- Pudding: Unit heals an additional 10 HP each turn (All units)
		- Nice Jingle: Unit steals Gold equal to 50% of the damage inflicted on a city, and get points towards a Golden Age on kills. Also, when it is fortified on a tile that produces Gold, it will give additional Gold equal to the tile's Gold yield, and if it is on a Bonus Panel, it doubles the Gold given at the start of a turn (All Melee units)
		- Dash!: +1 Movement (All non-Air units)
		- I'm on Fire!: Attack increased by 33% and Defense decreased by 33% (All non-Air units) / Ranged Attack, Interception and Air Sweep Attack strength increased by +33%, Interception Defense decreased by -33% (All Air units)
		- Rainbow-Colored Circle: +2 Movement and Defense decreased by 25% (All non-Air units) / Evasion increased by 50% and Interception Defense decreased by 25% (All Air units)
		- Rbits: Defense increased by +50%, -1 Movement (All non-Air units)
		- Extend: Unit is revived at half HP if it is destroyed. Can only happen once for the unit. Aircraft will only revive if the tile they were on is still a valid base (All units)
		- Big Magnum: Combat Strength when attacking cities increased by +150%, Defense Strength decreased by -25% (Archery, Siege and Naval Ranged units) / Attack Strength when attacking cities increased by +150%, Interception Defense decreased by -25% (Bomber units)
			- When using Whoward69's Various Mod Components or the Community Patch, HP will be reduced by 25 instead
		- Dinner: Allows adjacent units to heal an additional 5 HP each turn (All units)
		- Shield: Defense increased by +75%, but the unit will be unable to initiate an attack (Melee, Gunpowder and Recon units)
		- Long Distance Shot: +1 Range (Archery, Siege and Naval Ranged units) / +2 Range (All Air units)
		- Passionate Research: If the unit is fortified on a tile that produces Science, it will give additional Science equal to the tile's Science yield (All Land Melee and Archery units)
		- Tactical Retreat: 50% chance of retreating from a Melee attack, and the unit ignores enemy Zone of Control (All Land Melee and Archery units)
		- Accel Hyper: Attack increased by 20%, the unit may attack twice per turn and can move after attacking (All units)
		- Windy Enchantment: +1 Movement and the unit ignores terrain cost, but does not get defensive bonuses from terrain (Melee, Gunpowder, Recon and Archery units)
		- Unlucky Charm: While the unit is in the owner's territory, Combat Strength is decreased by 25% and the owner loses 2 Gold per turn (All Land Melee and Naval Melee units)
		- Quick Restoration: Heals 50 HP if it destroys a unit (All units)
		- Hyper Mode: Attack is increased by 25%, the unit reduces the Combat Strength of adjacent enemy units by 10%, and will heal even if it performs an action (All non-Air units):
		- Accelerator: +3 Movement, but if the unit is involved in a battle, it will not be able to move the following turn (All non-Air units)
		- x16 Big Rocket: Combat Strength against Land and Naval units increased by 50% (All Air units)
		- Protagonist's Privilege: Enemy units this unit attacks are forced backwards into a free tile if possible. It also boosts surronding units like a Great General, and can move after attacking (All Land Melee units)
		- Binding Chain: Adjacent enemy units will be unable to move on their turn. This effect cannot be applied to a specific enemy unit on consecutive turns (All non-Air units)
		- Air Strike: Ranged Attack increased by 100% and Interception Defense increased by 50%, -2 Range (Bomber units)
		- Blue Crow the Second: Ranged Attack and Interception Defense increased by +10%, +1 Range but Evasion decreased by 10% for every level past 1 (up to 6) (Fighter units)
			- The total stats change at level 6 will be Ranged Attack and Interception Defense increased by +50%, +5 Range but Evasion decreased by 50%
		- Self-Destruct: When the unit is killed, inflict 25 HP of damage to adjacent units (All non-Air units)
			- This effects *any* adjacent units, including your own
			- If a unit would be destroyed, its HP is decreased to 1 instead
	- Draw Panel traps:
		- Sky Restaurant 'Pures':	(1/10 chance)	Unit will fully heal HP, but the owner has to pay Gold equal to the amount of HP healed (or all of their current Gold if the unit's owner doesn't have enough) (Cannot be activated by Barbarians)
		- Dangerous Pudding:		(1/5 chance)	Unit will be unable to move this turn
		- Mimyuu's Hammer:			(1/5 chance)	Unit takes 25 HP damage (or reduces to 1 if it would kill the unit)
		- Go Away:					(1/5 chance)	Unit is sent to a free random tile 3 to 5 tiles away (land for land units, and water for naval units)
		- Heat 300%:				(3/20 chance)	Unit will have its (ranged) defense reduced by 50% for three turns
		- Piggy Bank:				(1/10 chance)	Unit's owner gains Gold equal to the unit's level x 5 (Cannot be activated by Barbarians)
		- Big Bang Bell:			(1/20 chance)	All units on and adjacent to the Panel receive 25 HP damage. Only the unit that activated the trap can be killed. The Panel's owner steals Gold equal to the unit's level x 5 if it is killed (or all of their current Gold it if the unit's owner doesn't have enough) (Cannot be activated by Barbarians)
	- Encounter Panel strengths and yields:
		- Normal: 														-25% attack, +25% defense, 50 gold
		- Owner in golden age:											+50% defense, 100 gold
		- Activated by player at war with owner:						+25% attack, +75% defense, 150 gold
		- Activated by player at war with owner, owner in golden age:	+50% attack, +100% defense, 200 gold
- Rigged Tomomo's changes:
	- Chance for Marie Poppo to steal something when passing a unit is 1/3 rather than 1/4
	- Chance to steal a Technology is 1/4 as opposed to 1/8
	- Chance to steal promotions or HP is 1/2 as opposed to 1/3
	- Will always try to steal HP over a promotion if able
	- More powerful traps on Draw panels appear more often, while ones that have some benefit to the person who activated them appear rarely
		- Sky Restaurant 'Pures':	1/20 chance
		- Dangerous Pudding:		1/5 chance
		- Mimyuu's Hammer:			1/5 chance
		- Go Away:					3/20 chance
		- Heat 300%:				1/5 chance
		- Piggy Bank:				1/20 chance
		- Big Bang Bell:			3/20 chance
	- Better results from Roll and Move panels
		- Tomomo herself is more likely to get higher rolls when gaining movement and lower rolls when losing movement. Enemies that land on that Tomomo's panels are more likely to gain less and lose more

Credits:
- YukiMisaki: Art of Tomomo for the leader scene/Dawn of Man screen/leader icon, as well as for making the civilization and unit icons
- Vice Virtuoso: Dynamic 2D Leaderscreens
- saibotlieh: Skirted female spy model for Civ 4 (used for Marie Poppo model's body)
- Random Talking Bush: Head of Marie Poppo model
- JFD: MasterSupportFile.sql for supporting various mods
- 100% Orange Juice: Sprites for Marie Poppo and Marie Poppo (Mixed), textures for the Game Board Panel models, and the inspiration for this mod