Add a new "rechargeable" flag to items
A way to set this flag is not yet exposed in the scenario editor. The flag is intended only for non-stackable items, but this currently isn't enforced. Items now have a maximum number of charges, which is equal to their default number set in the item record. Enchanted items with charges are now rechargeable.
This commit is contained in:
@@ -28,8 +28,9 @@
|
||||
<cursed>true</cursed>
|
||||
<concealed>true</concealed>
|
||||
<enchanted>true</enchanted>
|
||||
<rechargeable>true</rechargeable>
|
||||
<unsellable>true</unsellable>
|
||||
</properties>
|
||||
<description>This is a silly, silly description.</description>
|
||||
</item>
|
||||
</items>
|
||||
</items>
|
||||
|
@@ -37,6 +37,7 @@ TEST_CASE("Converting items from legacy scenarios") {
|
||||
CHECK(new_item.bonus == 1);
|
||||
CHECK(new_item.protection == 3);
|
||||
CHECK(new_item.charges == 10);
|
||||
CHECK(new_item.max_charges == 10);
|
||||
CHECK(new_item.graphic_num == 62);
|
||||
CHECK(new_item.type_flag == 100);
|
||||
CHECK(new_item.value == 500);
|
||||
|
@@ -116,6 +116,7 @@ TEST_CASE("Loading an item type definition") {
|
||||
CHECK(scen.scen_items[0].bonus == 5);
|
||||
CHECK(scen.scen_items[0].protection == 4);
|
||||
CHECK(scen.scen_items[0].charges == 20);
|
||||
CHECK(scen.scen_items[0].max_charges == 20);
|
||||
CHECK(scen.scen_items[0].weap_type == eSkill::DEFENSE);
|
||||
CHECK(scen.scen_items[0].missile == 3);
|
||||
CHECK(scen.scen_items[0].type_flag == 9);
|
||||
@@ -130,6 +131,7 @@ TEST_CASE("Loading an item type definition") {
|
||||
CHECK(scen.scen_items[0].cursed);
|
||||
CHECK(scen.scen_items[0].concealed);
|
||||
CHECK(scen.scen_items[0].enchanted);
|
||||
CHECK(scen.scen_items[0].rechargeable);
|
||||
CHECK(scen.scen_items[0].unsellable);
|
||||
CHECK(scen.scen_items[0].desc == "This is a silly, silly description.");
|
||||
}
|
||||
|
@@ -78,6 +78,7 @@ TEST_CASE("Saving item types") {
|
||||
scen.scen_items[0].cursed = true;
|
||||
scen.scen_items[0].concealed = true;
|
||||
scen.scen_items[0].enchanted = true;
|
||||
scen.scen_items[0].rechargeable = true;
|
||||
scen.scen_items[0].unsellable = true;
|
||||
scen.scen_items[0].desc = " This is a silly, silly description. ";
|
||||
in_and_out("full", scen);
|
||||
@@ -86,6 +87,7 @@ TEST_CASE("Saving item types") {
|
||||
CHECK(scen.scen_items[0].bonus == 5);
|
||||
CHECK(scen.scen_items[0].protection == 4);
|
||||
CHECK(scen.scen_items[0].charges == 20);
|
||||
CHECK(scen.scen_items[0].max_charges == 20);
|
||||
CHECK(scen.scen_items[0].weap_type == eSkill::DEFENSE);
|
||||
CHECK(scen.scen_items[0].missile == 3);
|
||||
CHECK(scen.scen_items[0].type_flag == 9);
|
||||
@@ -100,6 +102,7 @@ TEST_CASE("Saving item types") {
|
||||
CHECK(scen.scen_items[0].cursed);
|
||||
CHECK(scen.scen_items[0].concealed);
|
||||
CHECK(scen.scen_items[0].enchanted);
|
||||
CHECK(scen.scen_items[0].rechargeable);
|
||||
CHECK(scen.scen_items[0].unsellable);
|
||||
CHECK(scen.scen_items[0].desc == " This is a silly, silly description. ");
|
||||
}
|
||||
|
Reference in New Issue
Block a user