Skip to content

Commit

Permalink
Opcode 0: Change AC type from bitfield to list
Browse files Browse the repository at this point in the history
  • Loading branch information
Argent77 committed Sep 16, 2024
1 parent 69fee65 commit df29b7e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/org/infinity/resource/effects/BaseOpcode.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public static enum EffectEntry {

public static final TreeMap<Long, String> DURATIONS_V1_MAP = new TreeMap<>();
public static final TreeMap<Long, String> DURATIONS_V2_MAP = new TreeMap<>();
public static final TreeMap<Long, String> AC_TYPES_MAP = new TreeMap<>();
public static final TreeMap<Long, String> COLOR_LOCATIONS_MAP = new TreeMap<>();
public static final TreeMap<Long, String> PROJECTILES_IWD_MAP = new TreeMap<>();
public static final TreeMap<Long, String> INC_TYPES_MAP = new TreeMap<>();
Expand Down Expand Up @@ -304,11 +305,6 @@ public static enum EffectEntry {
"", "Black", "Blue", "Chromatic", "Gold", "Green", "Purple", "Red", "White", "Ice", "Stone", "Magenta", "Orange"
};

public static final String[] AC_TYPES = {
"All weapons", "Crushing weapons", "Missile weapons", "Piercing weapons", "Slashing weapons",
"Set base AC to value"
};

public static final String[] DAMAGE_TYPES = {
"All", "Fire damage", "Cold damage", "Electricity damage", "Acid damage", "Magic damage", "Poison damage",
"Slashing damage", "Piercing damage", "Crushing damage", "Missile damage"
Expand Down Expand Up @@ -406,6 +402,13 @@ public static enum EffectEntry {
DURATIONS_V2_MAP.put(10L, "Instant/Limited (ticks)");
DURATIONS_V2_MAP.put(4096L, "Absolute duration");

AC_TYPES_MAP.put(0x0L, "All weapons");
AC_TYPES_MAP.put(0x1L, "Crushing weapons");
AC_TYPES_MAP.put(0x2L, "Missile weapons");
AC_TYPES_MAP.put(0x4L, "Piercing weapons");
AC_TYPES_MAP.put(0x8L, "Slashing weapons");
AC_TYPES_MAP.put(0x10L, "Set base AC to value");

COLOR_LOCATIONS_MAP.put(0x00L, "Armor (grey): Belt/Amulet");
COLOR_LOCATIONS_MAP.put(0x01L, "Armor (teal): Minor color");
COLOR_LOCATIONS_MAP.put(0x02L, "Armor (pink): Major color");
Expand Down
4 changes: 2 additions & 2 deletions src/org/infinity/resource/effects/Opcode000.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.infinity.datatype.Bitmap;
import org.infinity.datatype.Datatype;
import org.infinity.datatype.DecNumber;
import org.infinity.datatype.Flag;
import org.infinity.datatype.HashBitmap;
import org.infinity.resource.StructEntry;

/**
Expand All @@ -36,7 +36,7 @@ public Opcode000() {
protected String makeEffectParamsGeneric(Datatype parent, ByteBuffer buffer, int offset, List<StructEntry> list,
boolean isVersion1) {
list.add(new DecNumber(buffer, offset, 4, EFFECT_AC_VALUE));
list.add(new Flag(buffer, offset + 4, 4, EFFECT_BONUS_TO, AC_TYPES));
list.add(new HashBitmap(buffer, offset + 4, 4, EFFECT_BONUS_TO, AC_TYPES_MAP, false));
return null;
}

Expand Down

0 comments on commit df29b7e

Please sign in to comment.