Skip to content

Commit

Permalink
Actor: added a bunch of new setbase/setstat modes from tobex
Browse files Browse the repository at this point in the history
  • Loading branch information
lynxlynxlynx committed Apr 15, 2018
1 parent 45b8079 commit 60d29eb
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
48 changes: 48 additions & 0 deletions gemrb/core/Scriptable/Actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3510,6 +3510,30 @@ int Actor::NewStat(unsigned int StatIndex, ieDword ModifierValue, ieDword Modifi
//percentile
SetStat(StatIndex, BaseStats[StatIndex] * ModifierValue / 100, 1);
break;
case MOD_MULTIPLICATIVE:
SetStat(StatIndex, BaseStats[StatIndex] * ModifierValue, 1);
break;
case MOD_DIVISIVE:
SetStat(StatIndex, BaseStats[StatIndex] / ModifierValue, 1);
break;
case MOD_MODULUS:
SetStat(StatIndex, BaseStats[StatIndex] % ModifierValue, 1);
break;
case MOD_LOGAND:
SetStat(StatIndex, BaseStats[StatIndex] && ModifierValue, 1);
break;
case MOD_LOGOR:
SetStat(StatIndex, BaseStats[StatIndex] || ModifierValue, 1);
break;
case MOD_BITAND:
SetStat(StatIndex, BaseStats[StatIndex] & ModifierValue, 1);
break;
case MOD_BITOR:
SetStat(StatIndex, BaseStats[StatIndex] | ModifierValue, 1);
break;
case MOD_INVERSE:
SetStat(StatIndex, !BaseStats[StatIndex], 1);
break;
default:
Log(ERROR, "Actor", "Invalid modifier type passed to NewStat: %d (%s)!", ModifierType, LongName);
}
Expand All @@ -3533,6 +3557,30 @@ int Actor::NewBase(unsigned int StatIndex, ieDword ModifierValue, ieDword Modifi
//percentile
SetBase(StatIndex, BaseStats[StatIndex] * ModifierValue / 100);
break;
case MOD_MULTIPLICATIVE:
SetBase(StatIndex, BaseStats[StatIndex] * ModifierValue);
break;
case MOD_DIVISIVE:
SetBase(StatIndex, BaseStats[StatIndex] / ModifierValue);
break;
case MOD_MODULUS:
SetBase(StatIndex, BaseStats[StatIndex] % ModifierValue);
break;
case MOD_LOGAND:
SetBase(StatIndex, BaseStats[StatIndex] && ModifierValue);
break;
case MOD_LOGOR:
SetBase(StatIndex, BaseStats[StatIndex] || ModifierValue);
break;
case MOD_BITAND:
SetBase(StatIndex, BaseStats[StatIndex] & ModifierValue);
break;
case MOD_BITOR:
SetBase(StatIndex, BaseStats[StatIndex] | ModifierValue);
break;
case MOD_INVERSE:
SetBase(StatIndex, !BaseStats[StatIndex]);
break;
default:
Log(ERROR, "Actor", "Invalid modifier type passed to NewBase: %d (%s)!", ModifierType, LongName);
}
Expand Down
8 changes: 8 additions & 0 deletions gemrb/core/Scriptable/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ namespace GemRB {
#define MOD_ADDITIVE 0
#define MOD_ABSOLUTE 1
#define MOD_PERCENT 2
#define MOD_MULTIPLICATIVE 3
#define MOD_DIVISIVE 4
#define MOD_MODULUS 5
#define MOD_LOGAND 6
#define MOD_LOGOR 7
#define MOD_BITAND 8
#define MOD_BITOR 9
#define MOD_INVERSE 10

//'do not jump' flags
#define DNJ_FIT 1
Expand Down

0 comments on commit 60d29eb

Please sign in to comment.