Siehe fillContainer-Funktion. Ich aktualisiere einfach den innerHTML-Inhalt des Containers.
Dadurch, dass ich den gesamten HTML-Inhalt des Container-Elementes ersetze, muss ich natürlich auch einzelne Formatierungen berücksichtigen/einbinden (bspw. dass der Name fett geschrieben wird).
Ob's die beste Lösung ist - keine Ahnung. Aber es funktioniert. ;-)
Im TitanCalc.Com ist es in der storm.js bspw. so gelöst (nur ein Auszug):
// set attributes
if (!AttributesBase[0]) { // base att's are only set one time
AttributesBase[0] = new Attribute(300,300,50,50,50) // base stats for characters
}
Attributes = new Array();
Attributes[1] = new Attribute(21,15,0,1,3)
Attributes[2] = new Attribute(42,30,0,2,6)
Attributes[3] = new Attribute(63,45,0,3,9)
Attributes[4] = new Attribute(84,60,0,4,12)
Attributes[5] = new Attribute(105,75,0,5,15)
Attributes[6] = new Attribute(126,90,0,6,18)
Attributes[7] = new Attribute(147,105,0,7,21)
Attributes[8] = new Attribute(168,120,0,8,24)
Attributes[9] = new Attribute(189,135,0,9,27)
Attributes[10] = new Attribute(210,150,0,10,30)
Attributes[11] = new Attribute(231,165,0,11,33)
Attributes[12] = new Attribute(252,180,0,12,36)
Attributes[13] = new Attribute(273,195,0,13,39)
Attributes[14] = new Attribute(294,210,0,14,42)
Attributes[15] = new Attribute(315,225,0,15,45)
Attributes[16] = new Attribute(336,240,0,16,48)
Attributes[17] = new Attribute(357,255,0,17,51)
Attributes[18] = new Attribute(378,270,0,18,54)
Attributes[19] = new Attribute(399,285,0,19,57)
Attributes[20] = new Attribute(420,300,0,20,60)
Attributes[21] = new Attribute(441,315,0,21,63)
Attributes[22] = new Attribute(462,330,0,22,66)
Attributes[23] = new Attribute(483,345,0,23,69)
Attributes[24] = new Attribute(504,360,0,24,72)
Attributes[25] = new Attribute(525,375,0,25,75)
Attributes[26] = new Attribute(546,390,0,26,78)
Attributes[27] = new Attribute(567,405,0,27,81)
Attributes[28] = new Attribute(588,420,0,28,84)
Attributes[29] = new Attribute(609,435,0,29,87)
Attributes[30] = new Attribute(630,450,0,30,90)
Attributes[31] = new Attribute(651,465,0,31,93)
Attributes[32] = new Attribute(672,480,0,32,96)
Skills = new Array();
// Ice Shard
Spells = new Array();
Spells[1] = new SpellInfo("21 Energy Cost, 1 Projectile, 16-25 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[2] = new SpellInfo("23 Energy Cost, 1 Projectile, 20-31 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[3] = new SpellInfo("25 Energy Cost, 1 Projectile, 23-36 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[4] = new SpellInfo("27 Energy Cost, 1 Projectile, 28-43 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[5] = new SpellInfo("29 Energy Cost, 1 Projectile, 32-47 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[6] = new SpellInfo("31 Energy Cost, 1 Projectile, 36-53 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[7] = new SpellInfo("33 Energy Cost, 1 Projectile, 39-58 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[8] = new SpellInfo("35 Energy Cost, 1 Projectile, 44-64 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[9] = new SpellInfo("37 Energy Cost, 1 Projectile, 48-68 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[10] = new SpellInfo("39 Energy Cost, 1 Projectile, 52-73 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[11] = new SpellInfo("41 Energy Cost, 1 Projectile, 55-77 Cold Damage, 15% Slowed for 1.5 Seconds")
Spells[12] = new SpellInfo("43 Energy Cost, 1 Projectile, 60-83 Cold Damage, 15% Slowed for 1.5 Seconds")
Skills[0] = new Skill("Ice Shard",1,Spells,-1,"Projects a deadly shard of ice at the target inflicting cold damage and temporarily slowing them.")