This Trac instance is not used for development anymore!

We migrated our development workflow to git and Gitea.
To test the future redirection, replace trac by ariadne in the page URL.

Ticket #2160: regicideWIP_v2.patch

File regicideWIP_v2.patch, 16.8 KB (added by Sandarac, 8 years ago)

Every player starts with a "saint" unit (placeholder) that is visually based on the civ's healer unit. Works on maps that start with civic centers.

  • binaries/data/mods/public/maps/scripts/Regicide.js

     
     1Trigger.prototype.CheckRegicideDefeat = function(data)
     2{
     3    if (data.entity == cmpTrigger.saints[data.from])
     4        TriggerHelper.DefeatPlayer(data.from);
     5};
     6
     7Trigger.prototype.InitGame = function(msg)
     8{
     9    var numberOfPlayers = TriggerHelper.GetNumberOfPlayers();
     10
     11    for (var i = 1; i < numberOfPlayers; ++i)
     12    {
     13        let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
     14        let playerEntities = cmpRangeManager.GetEntitiesByPlayer(i);
     15
     16        for (let entity of playerEntities)
     17            if (TriggerHelper.EntityHasClass(entity, "CivilCentre"))
     18                cmpTrigger.playerCivicCenter[i] = entity;
     19    }
     20
     21    let cmpPlayerManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager);
     22    let numPlayers = cmpPlayerManager.GetNumPlayers();
     23
     24    let player = 1
     25    for (let civCenter in cmpTrigger.playerCivicCenter)
     26    {
     27        let cmpPlayer = QueryPlayerIDInterface(player);
     28        let civ = cmpPlayer.GetCiv();
     29        let template = "units/" + civ + "_hero_saint";
     30        TriggerHelper.SpawnUnits(cmpTrigger.playerCivicCenter[civCenter], template, 1, player);
     31        ++player;
     32    }
     33
     34    for (var i = 1; i < numberOfPlayers; ++i)
     35    {
     36        let cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
     37        let playerEntities = cmpRangeManager.GetEntitiesByPlayer(i);
     38
     39        for (let entity of playerEntities)
     40            if (TriggerHelper.EntityHasClass(entity, "Saint"))
     41                cmpTrigger.saints[i] = entity;
     42    }
     43};
     44
     45var cmpTrigger = Engine.QueryInterface(SYSTEM_ENTITY, IID_Trigger);
     46cmpTrigger.playerCivicCenter = {};
     47cmpTrigger.saints = {};
     48cmpTrigger.DoAfterDelay(0, "InitGame", {});
     49
     50cmpTrigger.RegisterTrigger("OnOwnershipChanged", "CheckRegicideDefeat", { "enabled": true });
  • binaries/data/mods/public/simulation/components/Identity.js

     
    6464        "</element>" +
    6565    "</optional>" +
    6666    "<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, 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'>" +
     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'>" +
    6868            "<attribute name='datatype'>" +
    6969                "<value>tokens</value>" +
    7070            "</attribute>" +
  • binaries/data/mods/public/simulation/components/interfaces/Saint.js

     
     1Engine.RegisterInterface("Saint");
  • binaries/data/mods/public/simulation/components/Saint.js

     
     1function Saint() {}
     2
     3Saint.prototype.Schema = "<a:component type='system'/><empty/>";
     4
     5Saint.prototype.Init = function()
     6{
     7};
     8
     9Saint.prototype.Serialize = null;
     10
     11Engine.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_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</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_saint">
     3  <Identity>
     4    <Civ>athen</Civ>
     5    <Lang>greek</Lang>
     6    <SelectionGroupName>units/athen_hero_saint</SelectionGroupName>
     7    <SpecificName>Saint</SpecificName>
     8    <Icon>units/hele_support_healer.png</Icon>
     9  </Identity>
     10  <VisualActor>
     11    <Actor>units/athenians/healer.xml</Actor>
     12  </VisualActor>
     13</Entity>
  • binaries/data/mods/public/simulation/templates/units/brit_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>brit</Civ>
     5    <SelectionGroupName>units/brit_hero_saint</SelectionGroupName>
     6    <SpecificName>Saint</SpecificName>
     7    <Icon>units/celt_support_healer.png</Icon>
     8  </Identity>
     9  <VisualActor>
     10    <Actor>units/celts/healer.xml</Actor>
     11  </VisualActor>
     12</Entity>
  • binaries/data/mods/public/simulation/templates/units/cart_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>cart</Civ>
     5    <Gender>female</Gender>
     6    <SelectionGroupName>units/cart_hero_saint</SelectionGroupName>
     7    <SpecificName>Saint</SpecificName>
     8    <Icon>units/cart_support_healer.png</Icon>
     9  </Identity>
     10  <VisualActor>
     11    <Actor>units/carthaginians/healer.xml</Actor>
     12  </VisualActor>
     13</Entity>
  • binaries/data/mods/public/simulation/templates/units/gaul_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>gaul</Civ>
     5    <SelectionGroupName>units/gaul_hero_saint</SelectionGroupName>
     6    <SpecificName>Saint</SpecificName>
     7    <Icon>units/celt_support_healer.png</Icon>
     8  </Identity>
     9  <VisualActor>
     10    <Actor>units/celts/healer.xml</Actor>
     11  </VisualActor>
     12</Entity>
  • binaries/data/mods/public/simulation/templates/units/iber_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>iber</Civ>
     5    <Gender>female</Gender>
     6    <SelectionGroupName>units/athen_hero_saint</SelectionGroupName>
     7    <GenericName>Saint</GenericName>
     8    <SpecificName>Saint</SpecificName>
     9    <Icon>units/iber_support_healer.png</Icon>
     10  </Identity>
     11  <VisualActor>
     12    <Actor>units/iberians/healer.xml</Actor>
     13  </VisualActor>
     14</Entity>
  • binaries/data/mods/public/simulation/templates/units/mace_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>mace</Civ>
     5    <Lang>greek</Lang>
     6    <SelectionGroupName>units/mace_hero_saint</SelectionGroupName>
     7    <SpecificName>Saint</SpecificName>
     8    <Icon>units/hele_support_healer.png</Icon>
     9  </Identity>
     10  <VisualActor>
     11    <Actor>units/hellenes/healer.xml</Actor>
     12  </VisualActor>
     13</Entity>
  • binaries/data/mods/public/simulation/templates/units/maur_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>maur</Civ>
     5    <SelectionGroupName>units/maur_hero_saint</SelectionGroupName>
     6    <GenericName>Saint</GenericName>
     7    <SpecificName>Saint</SpecificName>
     8    <Icon>units/maur_support_healer.png</Icon>
     9  </Identity>
     10  <VisualActor>
     11    <Actor>units/mauryans/healer.xml</Actor>
     12  </VisualActor>
     13</Entity>
  • binaries/data/mods/public/simulation/templates/units/pers_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>pers</Civ>
     5    <SelectionGroupName>units/pers_hero_saint</SelectionGroupName>
     6    <GenericName>Saint</GenericName>
     7    <SpecificName>Saint</SpecificName>
     8    <Icon>units/pers_support_healer.png</Icon>
     9  </Identity>
     10  <VisualActor>
     11    <Actor>units/persians/healer.xml</Actor>
     12  </VisualActor>
     13</Entity>
  • binaries/data/mods/public/simulation/templates/units/ptol_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>ptol</Civ>
     5    <SelectionGroupName>units/ptol_hero_saint</SelectionGroupName>
     6    <GenericName>Saint</GenericName>
     7    <SpecificName>Saint</SpecificName>
     8    <Icon>units/hele_support_healer.png</Icon>
     9  </Identity>
     10  <VisualActor>
     11    <Actor>units/ptolemies/healer.xml</Actor>
     12  </VisualActor>
     13</Entity>
  • binaries/data/mods/public/simulation/templates/units/rome_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>rome</Civ>
     5    <Lang>latin</Lang>
     6    <SelectionGroupName>units/rome_hero_saint</SelectionGroupName>
     7    <GenericName>Saint</GenericName>
     8    <SpecificName>Saint</SpecificName>
     9    <Icon>units/rome_support_healer.png</Icon>
     10  </Identity>
     11  <VisualActor>
     12    <Actor>units/romans/healer.xml</Actor>
     13  </VisualActor>
     14</Entity>
  • binaries/data/mods/public/simulation/templates/units/sele_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>sele</Civ>
     5    <Lang>greek</Lang>
     6    <SelectionGroupName>units/sele_hero_saint</SelectionGroupName>
     7    <SpecificName>Hiereús</SpecificName>
     8    <Icon>units/hele_support_healer.png</Icon>
     9  </Identity>
     10  <VisualActor>
     11    <Actor>units/hellenes/healer.xml</Actor>
     12  </VisualActor>
     13</Entity>
  • binaries/data/mods/public/simulation/templates/units/spart_hero_saint.xml

     
     1<?xml version="1.0" encoding="utf-8"?>
     2<Entity parent="template_unit_saint">
     3  <Identity>
     4    <Civ>spart</Civ>
     5    <Lang>greek</Lang>
     6    <SelectionGroupName>units/spart_hero_saint</SelectionGroupName>
     7    <SpecificName>Saint</SpecificName>
     8    <Icon>units/hele_support_healer.png</Icon>
     9  </Identity>
     10  <VisualActor>
     11    <Actor>units/spartans/healer.xml</Actor>
     12  </VisualActor>
     13</Entity>
     14 No newline at end of file
  • source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Map/Map.cpp

     
    1 /* Copyright (C) 2015 Wildfire Games.
     1/* Copyright (C) 2016 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
    44 * 0 A.D. is free software: you can redistribute it and/or modify
     
    148148    gameTypes.Add(_T("conquest_units"));
    149149    gameTypes.Add(_T("wonder"));
    150150    gameTypes.Add(_T("endless"));
     151    gameTypes.Add(_T("regicide"));
    151152
    152153    wxFlexGridSizer* gridSizer = new wxFlexGridSizer(2, 5, 5);
    153154    gridSizer->AddGrowableCol(1);