Add feats to creature attributes
- Load feats from UTC - Implement GetHasFeat
This commit is contained in:
parent
081b4877b8
commit
ba0e987bb1
7 changed files with 90 additions and 60 deletions
|
@ -18,6 +18,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "../types.h"
|
||||
|
@ -104,10 +105,20 @@ public:
|
|||
|
||||
// END Skills
|
||||
|
||||
// Feats
|
||||
|
||||
bool hasFeat(FeatType type) const { return _feats.count(type) > 0; }
|
||||
|
||||
void addFeat(FeatType type) { _feats.insert(type); }
|
||||
void removeFeat(FeatType type) { _feats.erase(type); }
|
||||
|
||||
// END Feats
|
||||
|
||||
private:
|
||||
std::vector<std::pair<ClassType, int>> _classLevels;
|
||||
std::map<Ability, int> _abilityScores;
|
||||
std::map<Skill, int> _skillRanks;
|
||||
std::set<FeatType> _feats;
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
|
|
|
@ -100,6 +100,10 @@ void Creature::loadUTC(const GffStruct &utc) {
|
|||
bool dropable = itemGffs->getBool("Dropable");
|
||||
addItem(resRef, 1, dropable);
|
||||
}
|
||||
for (auto &featGffs : utc.getList("FeatList")) {
|
||||
auto feat = static_cast<FeatType>(featGffs->getUint("Feat"));
|
||||
_attributes.addFeat(feat);
|
||||
}
|
||||
|
||||
// Unused fields:
|
||||
//
|
||||
|
|
|
@ -328,6 +328,7 @@ private:
|
|||
REO_DECL_ROUTINE(getGlobalLocation)
|
||||
REO_DECL_ROUTINE(getGlobalNumber)
|
||||
REO_DECL_ROUTINE(getGlobalString)
|
||||
REO_DECL_ROUTINE(getHasFeat)
|
||||
REO_DECL_ROUTINE(getHasSkill)
|
||||
REO_DECL_ROUTINE(getHasSpell)
|
||||
REO_DECL_ROUTINE(getHitDice)
|
||||
|
|
|
@ -188,6 +188,20 @@ Variable Routines::getLevelByClass(const VariablesList &args, ExecutionContext &
|
|||
return Variable::ofInt(result);
|
||||
}
|
||||
|
||||
Variable Routines::getHasFeat(const VariablesList &args, ExecutionContext &ctx) {
|
||||
bool result = false;
|
||||
auto feat = getEnum<FeatType>(args, 0);
|
||||
auto creature = getCreatureOrCaller(args, 1, ctx);
|
||||
|
||||
if (creature) {
|
||||
result = creature->attributes().hasFeat(feat);
|
||||
} else {
|
||||
debug("Script: getHasFeat: creature is invalid", 1, DebugChannels::script);
|
||||
}
|
||||
|
||||
return Variable::ofInt(static_cast<int>(result));
|
||||
}
|
||||
|
||||
Variable Routines::getHasSkill(const VariablesList &args, ExecutionContext &ctx) {
|
||||
bool result = false;
|
||||
auto creature = getCreatureOrCaller(args, 1, ctx);
|
||||
|
|
|
@ -327,7 +327,7 @@ void Routines::addKotorRoutines() {
|
|||
add("GetModuleItemAcquired", Object, { });
|
||||
add("GetModuleItemAcquiredFrom", Object, { });
|
||||
add("SetCustomToken", Void, { Int, String });
|
||||
add("GetHasFeat", Int, { Int, Object });
|
||||
add("GetHasFeat", Int, { Int, Object }, &Routines::getHasFeat);
|
||||
add("GetHasSkill", Int, { Int, Object }, &Routines::getHasSkill);
|
||||
add("ActionUseFeat", Void, { Int, Object }, &Routines::actionUseFeat);
|
||||
add("ActionUseSkill", Void, { Int, Object, Int, Object }, &Routines::actionUseSkill);
|
||||
|
|
|
@ -328,7 +328,7 @@ void Routines::addTslRoutines() {
|
|||
add("GetModuleItemAcquired", Object, { });
|
||||
add("GetModuleItemAcquiredFrom", Object, { });
|
||||
add("SetCustomToken", Void, { Int, String });
|
||||
add("GetHasFeat", Int, { Int, Object });
|
||||
add("GetHasFeat", Int, { Int, Object }, &Routines::getHasFeat);
|
||||
add("GetHasSkill", Int, { Int, Object }, &Routines::getHasSkill);
|
||||
add("ActionUseFeat", Void, { Int, Object }, &Routines::actionUseFeat);
|
||||
add("ActionUseSkill", Void, { Int, Object, Int, Object }, &Routines::actionUseSkill);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace reone {
|
|||
|
||||
namespace graphics {
|
||||
|
||||
#define DECL_ANIM_PROP(a, b, c) \
|
||||
#define REO_DECL_ANIMPROP(a, b, c) \
|
||||
const AnimatedProperty<a> &b() const { return c; }; \
|
||||
AnimatedProperty<a> &b() { return c; };
|
||||
|
||||
|
@ -236,66 +236,66 @@ public:
|
|||
const AnimatedProperty<glm::quat, SlerpInterpolator> &orientation() const { return _orientation; }
|
||||
AnimatedProperty<glm::quat, SlerpInterpolator> &orientation() { return _orientation; }
|
||||
|
||||
DECL_ANIM_PROP(glm::vec3, position, _position)
|
||||
DECL_ANIM_PROP(float, scale, _scale)
|
||||
REO_DECL_ANIMPROP(glm::vec3, position, _position)
|
||||
REO_DECL_ANIMPROP(float, scale, _scale)
|
||||
|
||||
DECL_ANIM_PROP(glm::vec3, selfIllumColor, _selfIllumColor)
|
||||
DECL_ANIM_PROP(float, alpha, _alpha)
|
||||
REO_DECL_ANIMPROP(glm::vec3, selfIllumColor, _selfIllumColor)
|
||||
REO_DECL_ANIMPROP(float, alpha, _alpha)
|
||||
|
||||
DECL_ANIM_PROP(glm::vec3, color, _color)
|
||||
DECL_ANIM_PROP(float, radius, _radius)
|
||||
DECL_ANIM_PROP(float, shadowRadius, _shadowRadius)
|
||||
DECL_ANIM_PROP(float, verticalDisplacement, _verticalDisplacement)
|
||||
DECL_ANIM_PROP(float, multiplier, _multiplier)
|
||||
REO_DECL_ANIMPROP(glm::vec3, color, _color)
|
||||
REO_DECL_ANIMPROP(float, radius, _radius)
|
||||
REO_DECL_ANIMPROP(float, shadowRadius, _shadowRadius)
|
||||
REO_DECL_ANIMPROP(float, verticalDisplacement, _verticalDisplacement)
|
||||
REO_DECL_ANIMPROP(float, multiplier, _multiplier)
|
||||
|
||||
DECL_ANIM_PROP(float, alphaEnd, _alphaEnd)
|
||||
DECL_ANIM_PROP(float, alphaStart, _alphaStart)
|
||||
DECL_ANIM_PROP(float, birthrate, _birthrate)
|
||||
DECL_ANIM_PROP(float, bounceCo, _bounceCo)
|
||||
DECL_ANIM_PROP(float, combineTime, _combineTime)
|
||||
DECL_ANIM_PROP(float, drag, _drag)
|
||||
DECL_ANIM_PROP(float, fps, _fps)
|
||||
DECL_ANIM_PROP(float, frameEnd, _frameEnd)
|
||||
DECL_ANIM_PROP(float, frameStart, _frameStart)
|
||||
DECL_ANIM_PROP(float, grav, _grav)
|
||||
DECL_ANIM_PROP(float, lifeExp, _lifeExp)
|
||||
DECL_ANIM_PROP(float, mass, _mass)
|
||||
DECL_ANIM_PROP(float, p2pBezier2, _p2pBezier2)
|
||||
DECL_ANIM_PROP(float, p2pBezier3, _p2pBezier3)
|
||||
DECL_ANIM_PROP(float, particleRot, _particleRot)
|
||||
DECL_ANIM_PROP(float, randVel, _randVel)
|
||||
DECL_ANIM_PROP(float, sizeStart, _sizeStart)
|
||||
DECL_ANIM_PROP(float, sizeEnd, _sizeEnd)
|
||||
DECL_ANIM_PROP(float, sizeStartY, _sizeStartY)
|
||||
DECL_ANIM_PROP(float, sizeEndY, _sizeEndY)
|
||||
DECL_ANIM_PROP(float, spread, _spread)
|
||||
DECL_ANIM_PROP(float, threshold, _threshold)
|
||||
DECL_ANIM_PROP(float, velocity, _velocity)
|
||||
DECL_ANIM_PROP(float, xSize, _xSize)
|
||||
DECL_ANIM_PROP(float, ySize, _ySize)
|
||||
DECL_ANIM_PROP(float, blurLength, _blurLength)
|
||||
DECL_ANIM_PROP(float, lightingDelay, _lightingDelay)
|
||||
DECL_ANIM_PROP(float, lightingRadius, _lightingRadius)
|
||||
DECL_ANIM_PROP(float, lightingScale, _lightingScale)
|
||||
DECL_ANIM_PROP(float, lightingSubDiv, _lightingSubDiv)
|
||||
DECL_ANIM_PROP(float, lightingZigZag, _lightingZigZag)
|
||||
DECL_ANIM_PROP(float, alphaMid, _alphaMid)
|
||||
DECL_ANIM_PROP(float, percentStart, _percentStart)
|
||||
DECL_ANIM_PROP(float, percentMid, _percentMid)
|
||||
DECL_ANIM_PROP(float, percentEnd, _percentEnd)
|
||||
DECL_ANIM_PROP(float, sizeMid, _sizeMid)
|
||||
DECL_ANIM_PROP(float, sizeMidY, _sizeMidY)
|
||||
DECL_ANIM_PROP(float, randomBirthRate, _randomBirthRate)
|
||||
DECL_ANIM_PROP(float, targetSize, _targetSize)
|
||||
DECL_ANIM_PROP(float, numControlPts, _numControlPts)
|
||||
DECL_ANIM_PROP(float, controlPtRadius, _controlPtRadius)
|
||||
DECL_ANIM_PROP(float, controlPtDelay, _controlPtDelay)
|
||||
DECL_ANIM_PROP(float, tangentSpread, _tangentSpread)
|
||||
DECL_ANIM_PROP(float, tangentLength, _tangentLength)
|
||||
DECL_ANIM_PROP(glm::vec3, colorMid, _colorMid)
|
||||
DECL_ANIM_PROP(glm::vec3, colorEnd, _colorEnd)
|
||||
DECL_ANIM_PROP(glm::vec3, colorStart, _colorStart)
|
||||
DECL_ANIM_PROP(float, detonate, _detonate)
|
||||
REO_DECL_ANIMPROP(float, alphaEnd, _alphaEnd)
|
||||
REO_DECL_ANIMPROP(float, alphaStart, _alphaStart)
|
||||
REO_DECL_ANIMPROP(float, birthrate, _birthrate)
|
||||
REO_DECL_ANIMPROP(float, bounceCo, _bounceCo)
|
||||
REO_DECL_ANIMPROP(float, combineTime, _combineTime)
|
||||
REO_DECL_ANIMPROP(float, drag, _drag)
|
||||
REO_DECL_ANIMPROP(float, fps, _fps)
|
||||
REO_DECL_ANIMPROP(float, frameEnd, _frameEnd)
|
||||
REO_DECL_ANIMPROP(float, frameStart, _frameStart)
|
||||
REO_DECL_ANIMPROP(float, grav, _grav)
|
||||
REO_DECL_ANIMPROP(float, lifeExp, _lifeExp)
|
||||
REO_DECL_ANIMPROP(float, mass, _mass)
|
||||
REO_DECL_ANIMPROP(float, p2pBezier2, _p2pBezier2)
|
||||
REO_DECL_ANIMPROP(float, p2pBezier3, _p2pBezier3)
|
||||
REO_DECL_ANIMPROP(float, particleRot, _particleRot)
|
||||
REO_DECL_ANIMPROP(float, randVel, _randVel)
|
||||
REO_DECL_ANIMPROP(float, sizeStart, _sizeStart)
|
||||
REO_DECL_ANIMPROP(float, sizeEnd, _sizeEnd)
|
||||
REO_DECL_ANIMPROP(float, sizeStartY, _sizeStartY)
|
||||
REO_DECL_ANIMPROP(float, sizeEndY, _sizeEndY)
|
||||
REO_DECL_ANIMPROP(float, spread, _spread)
|
||||
REO_DECL_ANIMPROP(float, threshold, _threshold)
|
||||
REO_DECL_ANIMPROP(float, velocity, _velocity)
|
||||
REO_DECL_ANIMPROP(float, xSize, _xSize)
|
||||
REO_DECL_ANIMPROP(float, ySize, _ySize)
|
||||
REO_DECL_ANIMPROP(float, blurLength, _blurLength)
|
||||
REO_DECL_ANIMPROP(float, lightingDelay, _lightingDelay)
|
||||
REO_DECL_ANIMPROP(float, lightingRadius, _lightingRadius)
|
||||
REO_DECL_ANIMPROP(float, lightingScale, _lightingScale)
|
||||
REO_DECL_ANIMPROP(float, lightingSubDiv, _lightingSubDiv)
|
||||
REO_DECL_ANIMPROP(float, lightingZigZag, _lightingZigZag)
|
||||
REO_DECL_ANIMPROP(float, alphaMid, _alphaMid)
|
||||
REO_DECL_ANIMPROP(float, percentStart, _percentStart)
|
||||
REO_DECL_ANIMPROP(float, percentMid, _percentMid)
|
||||
REO_DECL_ANIMPROP(float, percentEnd, _percentEnd)
|
||||
REO_DECL_ANIMPROP(float, sizeMid, _sizeMid)
|
||||
REO_DECL_ANIMPROP(float, sizeMidY, _sizeMidY)
|
||||
REO_DECL_ANIMPROP(float, randomBirthRate, _randomBirthRate)
|
||||
REO_DECL_ANIMPROP(float, targetSize, _targetSize)
|
||||
REO_DECL_ANIMPROP(float, numControlPts, _numControlPts)
|
||||
REO_DECL_ANIMPROP(float, controlPtRadius, _controlPtRadius)
|
||||
REO_DECL_ANIMPROP(float, controlPtDelay, _controlPtDelay)
|
||||
REO_DECL_ANIMPROP(float, tangentSpread, _tangentSpread)
|
||||
REO_DECL_ANIMPROP(float, tangentLength, _tangentLength)
|
||||
REO_DECL_ANIMPROP(glm::vec3, colorMid, _colorMid)
|
||||
REO_DECL_ANIMPROP(glm::vec3, colorEnd, _colorEnd)
|
||||
REO_DECL_ANIMPROP(glm::vec3, colorStart, _colorStart)
|
||||
REO_DECL_ANIMPROP(float, detonate, _detonate)
|
||||
|
||||
// END Keyframes
|
||||
|
||||
|
|
Loading…
Reference in a new issue