summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp48
1 files changed, 47 insertions, 1 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 95142fecc..0b52592d4 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -242,6 +242,10 @@ Being::Being(const BeingId id,
mKarma(0),
mManner(0),
mAreaSize(11),
+ mCastEndTime(0),
+ mCastX1(0),
+ mCastSize(0),
+ mCastY1(0),
#ifdef EATHENA_SUPPORT
mCreatorId(BeingId_zero),
#endif
@@ -257,7 +261,8 @@ Being::Being(const BeingId id,
mAway(false),
mInactive(false),
mNeedPosUpdate(true),
- mPetAi(true)
+ mPetAi(true),
+ mDrawCast(false)
{
for (int f = 0; f < 20; f ++)
{
@@ -1783,6 +1788,12 @@ void Being::logic() restrict2
(*it)->update(time);
#endif
+ if (mCastEndTime != 0 && mCastEndTime < tick_time)
+ {
+ mCastEndTime = 0;
+ mDrawCast = false;
+ }
+
if (mAnimationEffect)
{
mAnimationEffect->update(time);
@@ -3486,9 +3497,25 @@ void Being::drawPlayer(Graphics *restrict const graphics,
drawBeingCursor(graphics, px, py);
drawPlayerSpriteAt(graphics, px, py);
#endif
+ if (mDrawCast)
+ drawCasting(graphics, offsetX, offsetY);
}
}
+void Being::drawCasting(Graphics *const graphics,
+ const int offsetX,
+ const int offsetY) const
+{
+ graphics->setColor(userPalette->getColorWithAlpha(
+ UserColorId::ATTACK_RANGE_BORDER));
+
+ graphics->drawRectangle(Rect(
+ mCastX1 + offsetX,
+ mCastY1 + offsetY,
+ mCastSize,
+ mCastSize));
+}
+
void Being::drawBeingCursor(Graphics *const graphics,
const int offsetX,
const int offsetY) const
@@ -5002,6 +5029,25 @@ void Being::serverRemove() restrict2 noexcept2
mTrickDead = false;
}
+void Being::addCast(const int dstX,
+ const int dstY,
+ const int skillId A_UNUSED,
+ const int range A_UNUSED,
+ const int waitTimeTicks)
+{
+ if (waitTimeTicks <= 0)
+ {
+ mCastEndTime = 0;
+ mDrawCast = false;
+ return;
+ }
+ mCastEndTime = tick_time + waitTimeTicks;
+ mDrawCast = true;
+ mCastX1 = (dstX - range) * mapTileSize;
+ mCastY1 = (dstY - range) * mapTileSize;
+ mCastSize = range * mapTileSize * 2 + mapTileSize;
+}
+
#ifdef EATHENA_SUPPORT
void Being::removeHorse() restrict2
{