Update for entity promotions.
This was SVN commit r1342.
This commit is contained in:
parent
5eb9480bf1
commit
f5723ecefe
@ -4,7 +4,6 @@
|
||||
<Traits extant="true" corpse="template_corpse">
|
||||
<Id
|
||||
type="true"
|
||||
rank="0"
|
||||
/>
|
||||
<!-- Defaults to no armour -->
|
||||
<Armour
|
||||
@ -14,6 +13,9 @@
|
||||
Pierce="0.0"
|
||||
/>
|
||||
<Health />
|
||||
<Up
|
||||
rank="0"
|
||||
/>
|
||||
</Traits>
|
||||
<Event On="Attack">
|
||||
<![CDATA[
|
||||
@ -47,11 +49,58 @@
|
||||
|
||||
if( this.traits.health.curr <= 0 )
|
||||
{
|
||||
this.kill();
|
||||
// If the inflictor gains promotions, and he's capable of earning more ranks,
|
||||
if (evt.inflictor.traits.up && evt.inflictor.traits.up.curr && evt.inflictor.traits.up.req && evt.inflictor.traits.up.newentity && evt.inflictor.traits.up.newentity != "")
|
||||
{
|
||||
// Give him the fallen's upgrade points (if he has any).
|
||||
if (this.traits.loot.up)
|
||||
evt.inflictor.traits.up.curr = parseInt(evt.inflictor.traits.up.curr) + parseInt(this.traits.loot.up);
|
||||
|
||||
// Notify player.
|
||||
if (this.traits.id.specific)
|
||||
console.write(this.traits.id.specific + " has earned " + this.traits.loot.up + " upgrade points!");
|
||||
else
|
||||
console.write("One of your units has earned " + this.traits.loot.up + " upgrade points!");
|
||||
|
||||
// If he now has maximum upgrade points for his rank,
|
||||
if (evt.inflictor.traits.up.curr >= evt.inflictor.traits.up.req)
|
||||
{
|
||||
// Notify the player.
|
||||
if (this.traits.id.specific)
|
||||
console.write(this.traits.id.specific + " has gained a promotion!");
|
||||
else
|
||||
console.write("One of your units has gained a promotion!");
|
||||
|
||||
// Reset his upgrade points.
|
||||
evt.inflictor.traits.up.curr = 0;
|
||||
|
||||
// Transmogrify him into his next rank.
|
||||
// evt.inflictor.template = getEntityTemplate(evt.inflictor.traits.up.newentity);
|
||||
}
|
||||
}
|
||||
/*
|
||||
// If the fallen is worth any loot,
|
||||
if (this.traits.loot && (this.traits.loot.food || this.traits.loot.wood || this.traits.loot.stone || this.traits.loot.ore))
|
||||
{
|
||||
// Give the inflictor his resources.
|
||||
if (this.traits.loot.food)
|
||||
GiveResources("Food", this.traits.loot.food);
|
||||
if (this.traits.loot.wood)
|
||||
GiveResources("Wood", this.traits.loot.wood);
|
||||
if (this.traits.loot.stone)
|
||||
GiveResources("Stone", this.traits.loot.stone);
|
||||
if (this.traits.loot.ore)
|
||||
GiveResources("Ore", this.traits.loot.ore);
|
||||
}
|
||||
*/
|
||||
// Notify player.
|
||||
if( evt.inflictor )
|
||||
console.write( this.traits.id.generic + " got the point of " + evt.inflictor.traits.id.generic + "'s Gladius." );
|
||||
else
|
||||
console.write( this.traits.id.generic + " died in mysterious circumstances." );
|
||||
|
||||
// We've taken what we need. Kill the swine.
|
||||
this.kill();
|
||||
}
|
||||
else if( evt.inflictor && this.actions.attack )
|
||||
{
|
||||
|
@ -9,8 +9,7 @@
|
||||
internal_only="false"
|
||||
|
||||
specific="Dude"
|
||||
ranked="Advanced Dude"
|
||||
rank="2"
|
||||
ranked="Basic Dude"
|
||||
personal="Vercinius Testiuso"
|
||||
personal1="rome_male_names_1st.csv"
|
||||
personal2="rome_male_names_2nd.csv"
|
||||
@ -25,6 +24,9 @@
|
||||
hack="0.5"
|
||||
pierce="0.5"
|
||||
/>
|
||||
<Up
|
||||
newentity="combat_dude_roman_a"
|
||||
/>
|
||||
</Traits>
|
||||
<Actions>
|
||||
<!-- 5 hack, 3 pierce damage... -->
|
||||
|
17
binaries/data/mods/official/entities/units/combat_dude_roman_a.xml
Executable file
17
binaries/data/mods/official/entities/units/combat_dude_roman_a.xml
Executable file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
|
||||
|
||||
<Entity Tag="combat_dude_roman_a" Parent="combat_dude_roman">
|
||||
<Actor>Roman Dude</Actor>
|
||||
<Traits>
|
||||
<Id
|
||||
ranked="Advanced Dude"
|
||||
/>
|
||||
<Up
|
||||
newentity="combat_dude_roman_u"
|
||||
rank="2"
|
||||
/>
|
||||
</Traits>
|
||||
<Actions>
|
||||
</Actions>
|
||||
</Entity>
|
||||
|
17
binaries/data/mods/official/entities/units/combat_dude_roman_u.xml
Executable file
17
binaries/data/mods/official/entities/units/combat_dude_roman_u.xml
Executable file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>
|
||||
|
||||
<Entity Tag="combat_dude_roman_u" Parent="combat_dude_roman_a">
|
||||
<Actor>Roman Dude</Actor>
|
||||
<Traits>
|
||||
<Id
|
||||
ranked="Ultimate Dude"
|
||||
/>
|
||||
<Up
|
||||
newentity=""
|
||||
rank="3"
|
||||
/>
|
||||
</Traits>
|
||||
<Actions>
|
||||
</Actions>
|
||||
</Entity>
|
||||
|
@ -13,13 +13,14 @@
|
||||
type.unit.group="true"
|
||||
type.unit.material="true"
|
||||
type.unit.attack="true"
|
||||
|
||||
rank="0"
|
||||
/>
|
||||
<Health
|
||||
curr="150"
|
||||
hitpoints="150"
|
||||
/>
|
||||
<Up
|
||||
rank="0"
|
||||
/>
|
||||
</Traits>
|
||||
<Footprint Radius="0.5"/>
|
||||
<Actions>
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
class2="Cavalry"
|
||||
|
||||
rank="1"
|
||||
|
||||
type.unit.group.military="true"
|
||||
type.unit.mounted="true"
|
||||
type.unit.material.organic="true"
|
||||
@ -16,17 +14,18 @@
|
||||
type.unit.group.citizensoldier="true"
|
||||
type.unit.group.worker="true"
|
||||
/>
|
||||
<Transform
|
||||
upreq="900"
|
||||
upcurr="0"
|
||||
/>
|
||||
<Loot
|
||||
up="20"
|
||||
up="200"
|
||||
food="1"
|
||||
wood="1"
|
||||
stone="1"
|
||||
ore="1"
|
||||
/>
|
||||
<Up
|
||||
curr="0"
|
||||
rank="1"
|
||||
req="900"
|
||||
/>
|
||||
</Traits>
|
||||
<Footprint Radius="1.5"/>
|
||||
<Actions>
|
||||
|
@ -7,8 +7,6 @@
|
||||
|
||||
class2="Infantry"
|
||||
|
||||
rank="1"
|
||||
|
||||
type.unit.group.military="true"
|
||||
type.unit.foot="true"
|
||||
type.unit.material.organic="true"
|
||||
@ -16,16 +14,17 @@
|
||||
type.unit.group.citizensoldier="true"
|
||||
type.unit.group.worker="true"
|
||||
/>
|
||||
<Transform
|
||||
upreq="600"
|
||||
upcurr="0"
|
||||
/>
|
||||
<Loot
|
||||
up="10"
|
||||
up="100"
|
||||
food="1"
|
||||
wood="1"
|
||||
stone="1"
|
||||
ore="1"
|
||||
/>
|
||||
<Up
|
||||
curr="0"
|
||||
rank="1"
|
||||
req="600"
|
||||
/>
|
||||
</Traits>
|
||||
</Entity>
|
@ -53,12 +53,12 @@ function manualDisplay()
|
||||
ManualRollover.caption += "Hitpoints: " + selection[0].traits.health.curr + "/" + selection[0].traits.health.hitpoints + "\n";
|
||||
|
||||
// Display rank.
|
||||
if (selection[0].traits.id.rank)
|
||||
ManualRollover.caption += "Rank: " + selection[0].traits.id.rank + "\n";
|
||||
if (selection[0].traits.up.rank)
|
||||
ManualRollover.caption += "Rank: " + selection[0].traits.up.rank + "\n";
|
||||
|
||||
// Display experience.
|
||||
if (selection[0].traits.transform && selection[0].traits.transform.upcurr && selection[0].traits.transform.upreq)
|
||||
ManualRollover.caption += "XP: " + selection[0].traits.transform.upcurr + "/" + selection[0].traits.transform.upreq + "\n";
|
||||
if (selection[0].traits.up && selection[0].traits.up.curr && selection[0].traits.up.req)
|
||||
ManualRollover.caption += "XP: " + selection[0].traits.up.curr + "/" + selection[0].traits.up.req + "\n";
|
||||
|
||||
// Display UP on death.
|
||||
if (selection[0].traits.loot.up)
|
||||
|
@ -56,6 +56,8 @@ function GiveResources(resourceName, resourceQty)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
console.write("Earned " + resourceQty + " resources.");
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
@ -132,9 +132,9 @@ function UpdateStatusOrb()
|
||||
}
|
||||
|
||||
// Update rank.
|
||||
if (selection[0].traits.id.rank > 1)
|
||||
if (selection[0].traits.up.rank > 1)
|
||||
{
|
||||
getGUIObjectByName("session_panel_status_icon_rank").sprite = "statistic_rank" + (selection[0].traits.id.rank-1);
|
||||
getGUIObjectByName("session_panel_status_icon_rank").sprite = "statistic_rank" + (selection[0].traits.up.rank-1);
|
||||
}
|
||||
else
|
||||
getGUIObjectByName("session_panel_status_icon_rank").sprite = "";
|
||||
@ -154,11 +154,11 @@ function UpdateStatusOrb()
|
||||
}
|
||||
|
||||
// Update upgrade points
|
||||
if (selection[0].traits.transform && selection[0].traits.transform.upcurr && selection[0].traits.transform.upreq)
|
||||
if (selection[0].traits.up && selection[0].traits.up.curr && selection[0].traits.up.req)
|
||||
{
|
||||
getGUIObjectByName("session_panel_status_icon_xp_text").caption = Math.round(selection[0].traits.transform.upcurr) + "/" + Math.round(selection[0].traits.transform.upreq);
|
||||
getGUIObjectByName("session_panel_status_icon_xp_text").caption = Math.round(selection[0].traits.up.curr) + "/" + Math.round(selection[0].traits.up.req);
|
||||
getGUIObjectByName("session_panel_status_icon_xp_text").hidden = false;
|
||||
getGUIObjectByName("session_panel_status_icon_xp_bar").caption = ((Math.round(selection[0].traits.transform.upcurr) * 100 ) / Math.round(selection[0].traits.transform.upreq));
|
||||
getGUIObjectByName("session_panel_status_icon_xp_bar").caption = ((Math.round(selection[0].traits.up.curr) * 100 ) / Math.round(selection[0].traits.up.req));
|
||||
getGUIObjectByName("session_panel_status_icon_xp_bar").hidden = false;
|
||||
}
|
||||
else
|
||||
|
@ -115,7 +115,7 @@
|
||||
<image backcolor="64 64 64" size="0 100%-1 100%-1 100%" />
|
||||
<image backcolor="128 128 128" size="100%-2 1 100%-1 100%-1" />
|
||||
<image backcolor="128 128 128" size="1 100%-2 100%-1 100%-1" />
|
||||
<image backcolor="0 200 200" size="0 0 100% 100%" />
|
||||
<image backcolor="255 255 0" size="0 0 100% 100%" />
|
||||
</sprite>
|
||||
|
||||
<sprite name="back-bar">
|
||||
@ -158,6 +158,10 @@
|
||||
<image texture="black_16x16.png" texture-size="0 0 16 16" size="0 0 100% 100%" />
|
||||
</sprite>
|
||||
|
||||
<sprite name="0ad_icon">
|
||||
<image texture="global/ui_gen_0ad-icon.png" size="0 0 100% 100%" texture-size="0 0 16 16" />
|
||||
</sprite>
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
MAP ORB
|
||||
@ -431,7 +435,7 @@
|
||||
MESSAGE BOX
|
||||
==========================================
|
||||
-->
|
||||
|
||||
|
||||
<sprite name="message_box-gen-background">
|
||||
<image texture="global/ui_gen_background_paper.png" size="0 0 100% 100%" texture-size="0 0 128 128" />
|
||||
</sprite>
|
||||
|
Loading…
Reference in New Issue
Block a user