#include "Capsule.h"
+#include "../common/Item.h"
#include "../common/Spell.h"
#include "../common/Stats.h"
#include "../graphics/Animation.h"
}
void Capsule::NextClass() {
+ if (maxClass == numClasses) {
+ return;
+ }
++curClass;
if (curClass >= maxClass) {
curClass = 0;
}
void Capsule::PreviousClass() {
+ if (maxClass == numClasses) {
+ return;
+ }
--curClass;
if (curClass < 0) {
curClass = maxClass - 1;
}
void Capsule::SetClass(int index) {
+ if (maxClass == numClasses) {
+ return;
+ }
curClass = index;
if (curClass < 0 ) {
curClass = 0;
return HungerEmpty();
}
-void Capsule::Feed(const common::Item *) {
+void Capsule::Feed(const common::Item *item) {
// TODO: find out how to calculate an item's feed value
// TODO: an item the capsule favors (changes on every feed and after every
// battle) doubles the value
}
}
+const common::Item *Capsule::UpgradeItem() const {
+ return GetClass().upgradeItem;
+}
+
+void Capsule::UpgradeSpecial() {
+ maxClass = GetClass().upgradeClass + 1;
+ curClass = GetClass().upgradeClass;
+}
+
Capsule::Class::Class()
: name(0)
, attackAnimation(0)
, spellAnimation(0)
+
+, upgradeItem(0)
+, upgradeClass(0)
, hunger(32)
, hungerFull(0)
td.AddField("attackAnimation", FieldDescription(((char *)&c.attackAnimation) - ((char *)&c), Animation::TYPE_ID).SetReferenced());
td.AddField("spellAnimation", FieldDescription(((char *)&c.spellAnimation) - ((char *)&c), Animation::TYPE_ID).SetReferenced());
+ td.AddField("upgradeItem", FieldDescription(((char *)&c.upgradeItem) - ((char *)&c), common::Item::TYPE_ID).SetReferenced());
+ td.AddField("upgradeClass", FieldDescription(((char *)&c.upgradeClass) - ((char *)&c), Interpreter::NUMBER_ID));
td.AddField("hunger", FieldDescription(((char *)&c.hunger) - ((char *)&c), Interpreter::NUMBER_ID));
td.AddField("healthBoost", FieldDescription(((char *)&c.healthBoost) - ((char *)&c), Interpreter::NUMBER_ID));
bool IsHungry() const;
void Feed(const common::Item *);
+ const common::Item *UpgradeItem() const;
+ void UpgradeSpecial();
+
Uint16 MaxHealth() const;
Stats GetStats() const;
graphics::Animation *attackAnimation;
graphics::Animation *spellAnimation;
+ const common::Item *upgradeItem;
+ int upgradeClass;
int hunger;
int hungerFull;
gameState.heroes[1].AddSpell(valorSpell);
gameState.inventory.Add(caster.GetItem("zirconPlateItem"), 32);
+ gameState.inventory.Add(caster.GetItem("holyFruitItem"));
+ gameState.inventory.Add(caster.GetItem("darkFruitItem"));
gameState.inventory.Add(caster.GetItem("antidoteItem"), 9);
gameState.inventory.Add(caster.GetItem("powerRingItem"));
gameState.inventory.Add(caster.GetItem("magicJarItem"), 4);
void CapsuleFeedMenu::FeedSelected() {
if (itemMenu.Selected()) {
// TODO: feed and grow animations
- GetCapsule().Feed(itemMenu.Selected());
- parent->Game().state->inventory.Remove(itemMenu.Selected(), 1);
- LoadInventory();
+ if (GetCapsule().IsHungry()) {
+ GetCapsule().Feed(itemMenu.Selected());
+ parent->Game().state->inventory.Remove(itemMenu.Selected(), 1);
+ LoadInventory();
+ } else if (itemMenu.Selected() == GetCapsule().UpgradeItem()) {
+ GetCapsule().UpgradeSpecial();
+ parent->Game().state->inventory.Remove(itemMenu.Selected(), 1);
+ LoadInventory();
+ } else {
+ // error beep
+ }
} else {
- // beep
+ // also beep
}
}
+include "items.l2h"
+
Sprite flashSprite1 {
image: :"flash.png",
size: <96, 96>
{ column: 0, row: 0, disposition: < 0, -16> }
]
},
+ upgradeItem: darkFruitItem,
+ upgradeClass: 4,
hunger: 0,
healthBoost: 208,
statBoost: Stats {
{ column: 0, row: 0, disposition: < 0, -16> }
]
},
+ upgradeItem: holyFruitItem,
+ upgradeClass: 3,
hunger: 0,
healthBoost: 208,
statBoost: Stats {
Sprite axIcon
Sprite ballIcon
Sprite crankIcon
+Item darkFruitItem
Item eagleRockItem
Item escapeItem
Item evilJewelItem
Sprite helmetIcon
Item hiPotionItem
Item holyCapItem
+Item holyFruitItem
Item holyRobeItem
Item holyShieldItem
Sprite jewelIcon
},
mostUseful: true
}
+export Item darkFruitItem {
+ name: "Dark Fruit",
+ battle: false
+}
export Item eagleRockItem {
name: "Eagle rock",
menuicon: jewelIcon,
equipability: helmet,
heroMask: 42 // Selan, Artea, Tia
}
+export Item holyFruitItem {
+ name: "Holy Fruit",
+ battle: false
+}
export Item holyRobeItem {
name: "Holy robe",
menuicon: armorIcon,