Ticket #2160: regicideWIP.patch
File regicideWIP.patch, 8.5 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/maps/scripts/Regicide.js
1 var saint = "units/athen_hero_saint" 2 3 Trigger.prototype.CheckRegicideDefeat = function(data) 4 { 5 if (data.entity == cmpTrigger.saints[data.from]) 6 TriggerHelper.DefeatPlayer(data.from); 7 8 }; 9 10 Trigger.prototype.InitGame = function(msg) 11 { 12 var numberOfPlayers = TriggerHelper.GetNumberOfPlayers(); 13 14 for (var i = 1; i < numberOfPlayers; ++i) 15 { 16 var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 17 var playerEntities = cmpRangeManager.GetEntitiesByPlayer(i); 18 19 for (let entity of playerEntities) 20 if (TriggerHelper.EntityHasClass(entity, "CivilCentre")) 21 cmpTrigger.playerCivicCenter[i] = entity; 22 } 23 24 let cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager); 25 let numPlayers = cmpPlayerManager.GetNumPlayers(); 26 27 let player = 1 28 for (let civCenter in cmpTrigger.playerCivicCenter) 29 { 30 TriggerHelper.SpawnUnits(cmpTrigger.playerCivicCenter[civCenter], saint, 1, player); 31 ++player; 32 } 33 34 for (var i = 1; i < numberOfPlayers; ++i) 35 { 36 var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 37 var playerEntities = cmpRangeManager.GetEntitiesByPlayer(i); // Get all of each player's entities 38 39 for (let entity of playerEntities) 40 if (TriggerHelper.EntityHasClass(entity, "Saint")) 41 cmpTrigger.saints[i] = entity; 42 } 43 44 }; 45 46 var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger); 47 cmpTrigger.playerCivicCenter = {}; 48 cmpTrigger.saints = {}; 49 cmpTrigger.DoAfterDelay(0, "InitGame", {}); 50 51 cmpTrigger.RegisterTrigger("OnOwnershipChanged", "CheckRegicideDefeat", { "enabled": true }); -
binaries/data/mods/public/simulation/components/Identity.js
64 64 "</element>" + 65 65 "</optional>" + 66 66 "<optional>" + 67 "<element name='Classes' a:help='Optional list of space-separated classes applying to this entity. Choices include: Unit, Infantry, Melee, Cavalry, Ranged, Mechanical, Ship, Siege, Champion, Hero, Elephant, Chariot, Mercenary, S pear, Sword, Bow, Javelin, Sling, Support, Animal, Domestic, Organic, Structure, Civic, CivCentre, Economic, Defensive, Gates, Wall, BarterMarket, Village, Town, City, ConquestCritical, Worker, Female, Healer, Slave, CitizenSoldier, Trade, Market, NavalMarket, Warship, SeaCreature, ForestPlant, DropsiteFood, DropsiteWood, DropsiteStone, DropsiteMetal, GarrisonTower, GarrisonFortress'>" +67 "<element name='Classes' a:help='Optional list of space-separated classes applying to this entity. Choices include: Unit, Infantry, Melee, Cavalry, Ranged, Mechanical, Ship, Siege, Champion, Hero, Elephant, Chariot, Mercenary, Saint, Spear, Sword, Bow, Javelin, Sling, Support, Animal, Domestic, Organic, Structure, Civic, CivCentre, Economic, Defensive, Gates, Wall, BarterMarket, Village, Town, City, ConquestCritical, Worker, Female, Healer, Slave, CitizenSoldier, Trade, Market, NavalMarket, Warship, SeaCreature, ForestPlant, DropsiteFood, DropsiteWood, DropsiteStone, DropsiteMetal, GarrisonTower, GarrisonFortress'>" + 68 68 "<attribute name='datatype'>" + 69 69 "<value>tokens</value>" + 70 70 "</attribute>" + -
binaries/data/mods/public/simulation/components/interfaces/Saint.js
1 Engine.RegisterInterface("Saint"); -
binaries/data/mods/public/simulation/components/Saint.js
1 function Saint() {} 2 3 Saint.prototype.Schema = "<a:component type='system'/><empty/>"; 4 5 Saint.prototype.Init = function() 6 { 7 }; 8 9 Saint.prototype.Serialize = null; 10 11 Engine.RegisterComponentType(IID_Saint, "Saint", Saint); -
binaries/data/mods/public/simulation/data/settings/victory_conditions/regicide.json
1 { 2 "TranslatedKeys": ["Title", "Description"], 3 "Data": 4 { 5 "Title": "Regicide", 6 "Description": "Keep your special unit alive to win", 7 "Scripts": 8 [ 9 "scripts/TriggerHelper.js", 10 "scripts/ConquestCommon.js", 11 "scripts/Conquest.js", 12 "scripts/Regicide.js" 13 ] 14 } 15 } -
binaries/data/mods/public/simulation/templates/template_unit_support_saint.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_unit_support"> 3 <Cost> 4 <Resources> 5 <food>250</food> 6 </Resources> 7 </Cost> 8 <Health> 9 <Max>600</Max> 10 </Health> 11 <Identity> 12 <Classes datatype="tokens">Saint</Classes> 13 <GenericName>Saint</GenericName> 14 <VisibleClasses datatype="tokens">Saint</VisibleClasses> 15 <Tooltip>Special unit for Regicide games.</Tooltip> 16 <Rank>Basic</Rank> 17 </Identity> 18 <Minimap> 19 <Type>hero</Type> 20 </Minimap> 21 <Selectable> 22 <Overlay> 23 <AlwaysVisible/> 24 <Texture> 25 <MainTexture>star/256x256.png</MainTexture> 26 <MainTextureMask>star/256x256_mask.png</MainTextureMask> 27 </Texture> 28 </Overlay> 29 </Selectable> 30 <Sound> 31 <SoundGroups> 32 <trained>interface/alarm/alarm_create_infantry.xml</trained> 33 <select>voice/{lang}/civ/civ_{gender}_select.xml</select> 34 <order_walk>voice/{lang}/civ/civ_{gender}_walk.xml</order_walk> 35 <order_attack>voice/{lang}/civ/civ_{gender}_go_out_against.xml</order_attack> 36 <order_gather>voice/{lang}/civ/civ_{gender}_gather.xml</order_gather> 37 <order_repair>voice/{lang}/civ/civ_{gender}_repair.xml</order_repair> 38 <order_heal>voice/{lang}/civ/civ_{gender}_heal.xml</order_heal> 39 <order_garrison>voice/{lang}/civ/civ_{gender}_garrison.xml</order_garrison> 40 <walk>actor/human/movement/walk.xml</walk> 41 <run>actor/human/movement/run.xml</run> 42 <death>actor/human/death/{gender}_death.xml</death> 43 </SoundGroups> 44 </Sound> 45 <Saint /> 46 <UnitMotion> 47 <WalkSpeed>9</WalkSpeed> 48 <Run> 49 <Speed>12.0</Speed> 50 <Range>200.0</Range> 51 <RangeMin>0.0</RangeMin> 52 </Run> 53 </UnitMotion> 54 <Vision> 55 <Range>30</Range> 56 </Vision> 57 <VisualActor> 58 <Actor>units/mauryans/hero_chanakya.xml</Actor> 59 </VisualActor> 60 </Entity> -
binaries/data/mods/public/simulation/templates/units/athen_hero_saint.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_unit_support_saint"> 3 <Identity> 4 <Civ>athen</Civ> 5 <Lang>greek</Lang> 6 <SelectionGroupName>units/athen_support_healer_b</SelectionGroupName> 7 <SpecificName>Saint</SpecificName> 8 <Icon>units/hele_support_healer.png</Icon> 9 </Identity> 10 </Entity> -
source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp
148 148 gameTypes.Add(_T("conquest_units")); 149 149 gameTypes.Add(_T("wonder")); 150 150 gameTypes.Add(_T("endless")); 151 gameTypes.Add(_T("regicide")); 151 152 152 153 wxFlexGridSizer* gridSizer = new wxFlexGridSizer(2, 5, 5); 153 154 gridSizer->AddGrowableCol(1);