Beginn des Kampf Systems
This commit is contained in:
@@ -23,6 +23,12 @@ public class SaveGame {
|
||||
public float x, y, z;
|
||||
/** itemId → Anzahl */
|
||||
public Map<String, Integer> inventory = new LinkedHashMap<>();
|
||||
/** Ausgerüstete Nahkampfwaffe (itemId, nullable). */
|
||||
public String equippedMeleeWeaponId;
|
||||
/** Ausgerüstete Fernkampfwaffe (itemId, nullable). */
|
||||
public String equippedRangedWeaponId;
|
||||
/** Ausgerüsteter Schild (itemId, nullable). */
|
||||
public String equippedShieldId;
|
||||
}
|
||||
|
||||
public static class WorldSave {
|
||||
|
||||
@@ -15,6 +15,8 @@ public class Item implements Interactable {
|
||||
private TextReference name;
|
||||
private TextReference description;
|
||||
private int worthGold;
|
||||
private int damage;
|
||||
private ItemGrip grip;
|
||||
private ObjectReference modelRef;
|
||||
private boolean consumable;
|
||||
private List<ConsumableEffect> effects;
|
||||
|
||||
@@ -8,6 +8,9 @@ import static de.blight.common.model.ItemCategory.QUEST_ITEMS;
|
||||
import static de.blight.common.model.ItemCategory.WEAPON;
|
||||
import static de.blight.common.model.ItemSubCategory.ARMOR;
|
||||
import static de.blight.common.model.ItemSubCategory.AXE;
|
||||
import static de.blight.common.model.ItemSubCategory.BOW;
|
||||
import static de.blight.common.model.ItemSubCategory.CROSSBOW;
|
||||
import static de.blight.common.model.ItemSubCategory.MAGIC_CRYSTAL;
|
||||
import static de.blight.common.model.ItemSubCategory.FOOD;
|
||||
import static de.blight.common.model.ItemSubCategory.HALBERD;
|
||||
import static de.blight.common.model.ItemSubCategory.HELM;
|
||||
@@ -36,7 +39,7 @@ public class ItemCategoryManager {
|
||||
private static final Map<ItemCategory, List<ItemSubCategory>> mapping = new EnumMap<ItemCategory, List<ItemSubCategory>>(ItemCategory.class);
|
||||
|
||||
static {
|
||||
mapping.put(WEAPON, List.of(SWORD, TWO_HANDED_SWORD, STAFF, HALBERD, AXE));
|
||||
mapping.put(WEAPON, List.of(SWORD, TWO_HANDED_SWORD, STAFF, HALBERD, AXE, BOW, CROSSBOW, MAGIC_CRYSTAL));
|
||||
mapping.put(GEAR, List.of(RING, NECKLACE, ARMOR, HELM, SHIELD));
|
||||
mapping.put(CONSUMABLES, List.of(POTION, PERMANENT_POTION, FOOD, MAGICAL_ITEM));
|
||||
mapping.put(QUEST_ITEMS, List.of(QUEST_ITEM));
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package de.blight.common.model;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/** Position und Ausrichtung des Griffes einer Waffe (in Metern / Grad). */
|
||||
@Getter
|
||||
@Setter
|
||||
public class ItemGrip {
|
||||
private float posX, posY, posZ;
|
||||
private float rotX, rotY, rotZ;
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package de.blight.common.model;
|
||||
|
||||
public enum ItemSubCategory {
|
||||
|
||||
SWORD, TWO_HANDED_SWORD, STAFF, HALBERD, AXE, //WEAPONS
|
||||
SWORD, TWO_HANDED_SWORD, STAFF, HALBERD, AXE, BOW, CROSSBOW, MAGIC_CRYSTAL, //WEAPONS
|
||||
RING, NECKLACE, ARMOR, HELM, SHIELD, //GEAR
|
||||
POTION, PERMANENT_POTION, FOOD, MAGICAL_ITEM,
|
||||
QUEST_ITEM,
|
||||
|
||||
@@ -44,6 +44,13 @@ public class MainCharacter extends GameCharacter {
|
||||
|
||||
private de.blight.common.model.abilities.Abilities abilities;
|
||||
|
||||
/** Aktuell ausgerüstete Nahkampfwaffe (SWORD, AXE oder TWO_HANDED_SWORD). */
|
||||
private Item equippedMeleeWeapon;
|
||||
/** Aktuell ausgerüstete Fernkampfwaffe (BOW, CROSSBOW oder MAGIC_CRYSTAL). */
|
||||
private Item equippedRangedWeapon;
|
||||
/** Schild-Slot – nur gültig wenn equippedMeleeWeapon.subCategory == SWORD. */
|
||||
private Item equippedShield;
|
||||
|
||||
/** Gespielte Monolog-IDs – wird serialisiert, damit jeder Monolog nur einmal abgespielt wird. */
|
||||
private Set<String> playedMonologueIds = new HashSet<>();
|
||||
|
||||
@@ -73,6 +80,27 @@ public class MainCharacter extends GameCharacter {
|
||||
@Setter(AccessLevel.NONE)
|
||||
private transient Queue<String> pendingDialogNpcIds = new ArrayDeque<>();
|
||||
|
||||
public void equipMelee(Item item) {
|
||||
equippedMeleeWeapon = item;
|
||||
if (item == null || item.getSubCategory() != ItemSubCategory.SWORD) {
|
||||
equippedShield = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void equipRanged(Item item) {
|
||||
equippedRangedWeapon = item;
|
||||
}
|
||||
|
||||
public void equipShield(Item item) {
|
||||
if (equippedMeleeWeapon != null && equippedMeleeWeapon.getSubCategory() == ItemSubCategory.SWORD) {
|
||||
equippedShield = item;
|
||||
}
|
||||
}
|
||||
|
||||
public void unequipMelee() { equipMelee(null); }
|
||||
public void unequipRanged() { equippedRangedWeapon = null; }
|
||||
public void unequipShield() { equippedShield = null; }
|
||||
|
||||
public void handleDialogOption(DialogOption option) {
|
||||
if (option.getRequiredItem() != null) {
|
||||
getInventar().remove(option.getRequiredItem());
|
||||
|
||||
Reference in New Issue
Block a user