MCPcopy Create free account
hub / github.com/TurningWheel/Barony / setBootSprite

Method setBootSprite

src/entity.cpp:20509–20777  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20507}
20508
20509bool Entity::setBootSprite(Entity* leg, int spriteOffset, bool forceShort)
20510{
20511 if ( multiplayer == CLIENT )
20512 {
20513 return false;
20514 }
20515
20516 Stat* myStats;
20517
20518 if ( this->behavior == &actPlayer )
20519 {
20520 myStats = stats[this->skill[2]]; // skill[2] contains the player number.
20521 }
20522 else
20523 {
20524 myStats = this->getStats();
20525 }
20526
20527 if ( myStats == nullptr )
20528 {
20529 return false;
20530 }
20531 if ( myStats->shoes == nullptr )
20532 {
20533 return false;
20534 }
20535
20536 Monster monsterType = myStats->type;
20537 if ( behavior == &actPlayer )
20538 {
20539 if ( effectShapeshift != NOTHING )
20540 {
20541 monsterType = static_cast<Monster>(effectShapeshift);
20542 }
20543 else if ( myStats->playerRace > 0 || myStats->getEffectActive(EFF_POLYMORPH) || effectPolymorph != NOTHING )
20544 {
20545 monsterType = getMonsterFromPlayerRace(myStats->playerRace);
20546 if ( effectPolymorph != NOTHING )
20547 {
20548 if ( effectPolymorph > NUMMONSTERS )
20549 {
20550 monsterType = HUMAN;
20551 }
20552 else
20553 {
20554 monsterType = static_cast<Monster>(effectPolymorph);
20555 }
20556 }
20557 }
20558 }
20559
20560 bool shortSprite = forceShort;
20561 switch ( monsterType )
20562 {
20563 case HUMAN:
20564 if ( !shortSprite )
20565 {
20566 if ( myStats->shoes->type == LEATHER_BOOTS || myStats->shoes->type == LEATHER_BOOTS_SPEED )

Callers 15

monsterSMoveBodypartsFunction · 0.80
monsterMMoveBodypartsFunction · 0.80
monsterGMoveBodypartsFunction · 0.80
goblinMoveBodypartsFunction · 0.80
actPlayerFunction · 0.80
vampireMoveBodypartsFunction · 0.80
automatonMoveBodypartsFunction · 0.80
monsterDMoveBodypartsFunction · 0.80
goatmanMoveBodypartsFunction · 0.80
succubusMoveBodypartsFunction · 0.80
gnomeMoveBodypartsFunction · 0.80
shopkeeperMoveBodypartsFunction · 0.80

Calls 2

getStatsMethod · 0.95
getMonsterFromPlayerRaceFunction · 0.85

Tested by

no test coverage detected