2023-11-20 23:25:36 -06:00
|
|
|
#pragma region License
|
2023-11-14 18:11:32 -06:00
|
|
|
/*
|
|
|
|
|
License (OLC-3)
|
|
|
|
|
~~~~~~~~~~~~~~~
|
|
|
|
|
|
2024-01-02 00:46:32 -06:00
|
|
|
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
|
2023-11-14 18:11:32 -06:00
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
|
|
|
are permitted provided that the following conditions are met:
|
|
|
|
|
|
|
|
|
|
1. Redistributions or derivations of source code must retain the above copyright
|
|
|
|
|
notice, this list of conditions and the following disclaimer.
|
|
|
|
|
|
|
|
|
|
2. Redistributions or derivative works in binary form must reproduce the above
|
|
|
|
|
copyright notice. This list of conditions and the following disclaimer must be
|
|
|
|
|
reproduced in the documentation and/or other materials provided with the distribution.
|
|
|
|
|
|
|
|
|
|
3. Neither the name of the copyright holder nor the names of its contributors may
|
|
|
|
|
be used to endorse or promote products derived from this software without specific
|
|
|
|
|
prior written permission.
|
|
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
|
|
|
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
|
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
|
|
|
|
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
|
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
|
|
|
|
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
|
|
|
|
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
|
|
|
|
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
|
SUCH DAMAGE.
|
2023-11-29 00:50:00 -06:00
|
|
|
|
2024-01-30 14:48:49 +00:00
|
|
|
Portions of this software are copyright © 2024 The FreeType
|
2023-11-29 00:50:00 -06:00
|
|
|
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
|
|
|
|
|
All rights reserved.
|
2023-11-14 18:11:32 -06:00
|
|
|
*/
|
2023-11-20 23:25:36 -06:00
|
|
|
#pragma endregion
|
2023-06-19 03:25:01 -05:00
|
|
|
#pragma once
|
2023-12-23 21:15:08 -06:00
|
|
|
#include <set>
|
|
|
|
|
#include "AttributableStat.h"
|
|
|
|
|
|
2023-06-19 03:25:01 -05:00
|
|
|
enum BuffType{
|
2023-12-23 21:15:08 -06:00
|
|
|
STAT_UP,
|
2023-06-19 03:25:01 -05:00
|
|
|
DAMAGE_REDUCTION,
|
|
|
|
|
SLOWDOWN,
|
2023-07-29 10:21:53 -05:00
|
|
|
BLOCK_SLOWDOWN,
|
2024-01-14 12:53:40 -06:00
|
|
|
LOCKON_SPEEDBOOST, //Specifically used for wolves.
|
|
|
|
|
SPEEDBOOST,
|
2024-01-24 17:13:33 -06:00
|
|
|
BARRIER_DAMAGE_REDUCTION, //Creates a visual barrier around the target
|
2024-01-24 22:44:18 -06:00
|
|
|
FIXED_COLLISION_DMG, //Does a fixed amount of collision damage based on intensity of this buff.
|
|
|
|
|
COLLISION_KNOCKBACK_STRENGTH, //Causes an amount of knockback based on intensity when hit via collision with this buff
|
2024-04-19 04:05:51 -05:00
|
|
|
SELF_INFLICTED_SLOWDOWN, //Used for monsters and can't be applied by any player abilities.
|
2024-07-19 05:49:33 -05:00
|
|
|
ADRENALINE_RUSH,
|
2024-07-21 16:11:41 -05:00
|
|
|
TRAPPER_MARK,
|
2024-07-23 04:07:43 -05:00
|
|
|
OVER_TIME,
|
|
|
|
|
ONE_OFF,
|
|
|
|
|
OVER_TIME_DURING_CAST,
|
2024-07-28 04:18:52 -05:00
|
|
|
GLOW_PURPLE,
|
2024-07-28 07:06:11 -05:00
|
|
|
COLOR_MOD,
|
2024-07-28 20:48:09 -05:00
|
|
|
DAMAGE_AMPLIFICATION, //Multiplies all incoming damage by this amount.
|
2024-08-05 17:33:53 -05:00
|
|
|
LETHAL_TEMPO,
|
2023-06-19 03:25:01 -05:00
|
|
|
};
|
2024-07-23 04:07:43 -05:00
|
|
|
enum class BuffRestorationType{
|
|
|
|
|
ONE_OFF,
|
|
|
|
|
OVER_TIME,
|
|
|
|
|
OVER_TIME_DURING_CAST,
|
|
|
|
|
};
|
|
|
|
|
namespace BuffOverTimeType{
|
|
|
|
|
enum BuffOverTimeType{
|
|
|
|
|
HP_RESTORATION,
|
|
|
|
|
HP_PCT_RESTORATION,
|
|
|
|
|
MP_RESTORATION,
|
|
|
|
|
MP_PCT_RESTORATION,
|
|
|
|
|
HP_DAMAGE_OVER_TIME,
|
|
|
|
|
HP_PCT_DAMAGE_OVER_TIME,
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-04 05:21:56 -06:00
|
|
|
class AiL;
|
2023-12-22 07:08:53 -06:00
|
|
|
|
2023-06-19 03:25:01 -05:00
|
|
|
struct Buff{
|
2024-07-28 03:46:17 -05:00
|
|
|
using PlayerBuffExpireCallbackFunction=std::function<void(Player*attachedTarget,Buff&b)>;
|
|
|
|
|
using MonsterBuffExpireCallbackFunction=std::function<void(std::weak_ptr<Monster>attachedTarget,Buff&b)>;
|
|
|
|
|
|
2023-06-19 03:25:01 -05:00
|
|
|
BuffType type;
|
2023-12-22 07:08:53 -06:00
|
|
|
float duration=1;
|
|
|
|
|
float timeBetweenTicks=1;
|
|
|
|
|
float intensity=1;
|
|
|
|
|
float nextTick=0;
|
2023-12-23 21:15:08 -06:00
|
|
|
std::set<ItemAttribute> attr;
|
2024-07-28 03:46:17 -05:00
|
|
|
std::variant<Player*,std::weak_ptr<Monster>>attachedTarget; //Who has this buff.
|
|
|
|
|
PlayerBuffExpireCallbackFunction playerBuffCallbackFunc=[](Player*p,Buff&b){};
|
|
|
|
|
MonsterBuffExpireCallbackFunction monsterBuffCallbackFunc=[](std::weak_ptr<Monster>m,Buff&b){};
|
2024-07-23 04:07:43 -05:00
|
|
|
|
2024-07-28 03:46:17 -05:00
|
|
|
Buff(std::variant<Player*,std::weak_ptr<Monster>>attachedTarget,BuffType type,float duration,float intensity);
|
|
|
|
|
Buff(std::variant<Player*,std::weak_ptr<Monster>>attachedTarget,BuffType type,float duration,float intensity,std::set<ItemAttribute> attr);
|
|
|
|
|
Buff(std::variant<Player*,std::weak_ptr<Monster>>attachedTarget,BuffType type,float duration,float intensity,std::set<std::string> attr);
|
|
|
|
|
Buff(std::variant<Player*,std::weak_ptr<Monster>>attachedTarget,BuffRestorationType type,BuffOverTimeType::BuffOverTimeType overTimeType,float duration,float intensity,float timeBetweenTicks);
|
|
|
|
|
Buff(std::variant<Player*,std::weak_ptr<Monster>>attachedTarget,BuffRestorationType type,BuffOverTimeType::BuffOverTimeType overTimeType,float duration,float intensity,float timeBetweenTicks,PlayerBuffExpireCallbackFunction expireCallbackFunc);
|
|
|
|
|
Buff(std::variant<Player*,std::weak_ptr<Monster>>attachedTarget,BuffRestorationType type,BuffOverTimeType::BuffOverTimeType overTimeType,float duration,float intensity,float timeBetweenTicks,MonsterBuffExpireCallbackFunction expireCallbackFunc);
|
2024-07-23 04:07:43 -05:00
|
|
|
|
|
|
|
|
void Update(AiL*game,float fElapsedTime);
|
|
|
|
|
private:
|
|
|
|
|
bool enabled{true};
|
|
|
|
|
std::optional<BuffOverTimeType::BuffOverTimeType>overTimeType;
|
|
|
|
|
void BuffTick(AiL*game,float fElapsedTime);
|
2023-06-19 03:25:01 -05:00
|
|
|
};
|