mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-03-25 06:49:07 +00:00
work on starfire damage profile; moved aura behavior into own folder and creates an aura container object; extended aura behavior to vehicles; applied target-control to aggravation effect
This commit is contained in:
parent
97e64d5edc
commit
66eb3b5b95
11 changed files with 241 additions and 104 deletions
|
|
@ -1,33 +1,52 @@
|
|||
// Copyright (c) 2017 PSForever
|
||||
package net.psforever.objects.ballistics
|
||||
|
||||
import net.psforever.objects.avatar.Aura
|
||||
import net.psforever.objects.equipment.TargetValidation
|
||||
import net.psforever.objects.serverobject.aggravated.Aura
|
||||
import net.psforever.objects.vital.DamageType
|
||||
|
||||
final case class AggravatedInfo(damage_type : DamageType.Value,
|
||||
degradation_percentage : Float,
|
||||
infliction_rate : Long) {
|
||||
final case class AggravatedInfo(damage_type: DamageType.Value,
|
||||
degradation_percentage: Float,
|
||||
infliction_rate: Long) {
|
||||
assert(damage_type == DamageType.Direct || damage_type == DamageType.Splash, s"aggravated damage is an unsupported type - $damage_type")
|
||||
}
|
||||
|
||||
final case class AggravatedDamage(info : List[AggravatedInfo],
|
||||
effect_type : Aura.Value,
|
||||
duration : Long,
|
||||
max_factor : Float,
|
||||
cumulative_damage_degrade : Boolean,
|
||||
vanu_aggravated : Boolean)
|
||||
final case class AggravatedDamage(info: List[AggravatedInfo],
|
||||
effect_type: Aura.Value,
|
||||
duration: Long,
|
||||
max_factor: Float,
|
||||
cumulative_damage_degrade: Boolean,
|
||||
vanu_aggravated: Boolean,
|
||||
targets: List[TargetValidation])
|
||||
|
||||
object AggravatedDamage {
|
||||
def apply(info : AggravatedInfo,
|
||||
effect_type : Aura.Value,
|
||||
duration : Long,
|
||||
max_factor : Float) : AggravatedDamage =
|
||||
AggravatedDamage(List(info), effect_type, duration, max_factor, cumulative_damage_degrade = true, vanu_aggravated = false)
|
||||
def apply(info: AggravatedInfo,
|
||||
effect_type: Aura.Value,
|
||||
duration: Long,
|
||||
max_factor: Float,
|
||||
targets: List[TargetValidation]): AggravatedDamage =
|
||||
AggravatedDamage(
|
||||
List(info),
|
||||
effect_type,
|
||||
duration,
|
||||
max_factor,
|
||||
cumulative_damage_degrade = true,
|
||||
vanu_aggravated = false,
|
||||
targets
|
||||
)
|
||||
|
||||
def apply(info : AggravatedInfo,
|
||||
effect_type : Aura.Value,
|
||||
duration : Long,
|
||||
max_factor : Float,
|
||||
vanu_aggravated : Boolean) : AggravatedDamage =
|
||||
AggravatedDamage(List(info), effect_type, duration, max_factor, cumulative_damage_degrade = true, vanu_aggravated)
|
||||
def apply(info: AggravatedInfo,
|
||||
effect_type: Aura.Value,
|
||||
duration: Long,
|
||||
max_factor: Float,
|
||||
vanu_aggravated: Boolean,
|
||||
targets: List[TargetValidation]): AggravatedDamage =
|
||||
AggravatedDamage(
|
||||
List(info),
|
||||
effect_type,
|
||||
duration,
|
||||
max_factor,
|
||||
cumulative_damage_degrade = true,
|
||||
vanu_aggravated,
|
||||
targets
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
// Copyright (c) 2020 PSForever
|
||||
package net.psforever.objects.avatar
|
||||
package net.psforever.objects.serverobject.aggravated
|
||||
|
||||
object Aura extends Enumeration {
|
||||
final val None = Value(0)
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
package net.psforever.objects.serverobject.aggravated
|
||||
|
||||
import net.psforever.objects.serverobject.aggravated.{Aura => AuraEffect}
|
||||
|
||||
trait AuraContainer {
|
||||
private var aura : Set[AuraEffect.Value] = Set.empty[AuraEffect.Value]
|
||||
|
||||
def Aura : Set[AuraEffect.Value] = aura
|
||||
|
||||
def AddEffectToAura(effect : AuraEffect.Value) : Set[AuraEffect.Value] = {
|
||||
if(effect != AuraEffect.None) {
|
||||
aura = aura + effect
|
||||
}
|
||||
Aura
|
||||
}
|
||||
|
||||
def RemoveEffectFromAura(effect : AuraEffect.Value) : Set[AuraEffect.Value] = {
|
||||
aura = aura - effect
|
||||
Aura
|
||||
}
|
||||
}
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
// Copyright (c) 2020 PSForever
|
||||
package net.psforever.objects.avatar
|
||||
package net.psforever.objects.serverobject.aggravated
|
||||
|
||||
import akka.actor.{Actor, Cancellable}
|
||||
import net.psforever.objects.Player
|
||||
import net.psforever.objects.ballistics._
|
||||
import net.psforever.objects.serverobject.PlanetSideServerObject
|
||||
import net.psforever.objects.serverobject.damage.Damageable
|
||||
import net.psforever.objects.vital.{DamageType, Vitality}
|
||||
import net.psforever.types.Vector3
|
||||
|
||||
import scala.collection.mutable
|
||||
import scala.concurrent.duration._
|
||||
import scala.concurrent.ExecutionContext.Implicits.global
|
||||
import scala.concurrent.duration._
|
||||
|
||||
trait AuraEffectBehavior {
|
||||
_ : Actor with Damageable =>
|
||||
|
|
@ -22,7 +22,7 @@ trait AuraEffectBehavior {
|
|||
private val entryIdToEntry: mutable.LongMap[AuraEffectBehavior.Entry] =
|
||||
mutable.LongMap.empty[AuraEffectBehavior.Entry]
|
||||
|
||||
def AuraTargetObject : Player
|
||||
def AuraTargetObject : AuraEffectBehavior.Target
|
||||
|
||||
val auraBehavior : Receive = {
|
||||
case AuraEffectBehavior.Aggravate(id, 0, 0) =>
|
||||
|
|
@ -93,7 +93,8 @@ trait AuraEffectBehavior {
|
|||
data.projectile.profile.Aggravated match {
|
||||
case Some(damage)
|
||||
if data.projectile.profile.ProjectileDamageTypes.contains(DamageType.Aggravated) &&
|
||||
damage.effect_type != Aura.None =>
|
||||
damage.effect_type != Aura.None && //TODO aphelion starfire
|
||||
damage.targets.exists(validation => validation.test(AuraTargetObject)) =>
|
||||
TryAggravationEffect(damage, data)
|
||||
case _ => ;
|
||||
}
|
||||
|
|
@ -104,7 +105,7 @@ trait AuraEffectBehavior {
|
|||
val obj = AuraTargetObject
|
||||
if(CheckForUniqueUnqueuedProjectile(data.projectile)) {
|
||||
val auraEffects = obj.Aura
|
||||
if(auraEffects.contains(effect) && aggravation.cumulative_damage_degrade) { //TODO cumulative?
|
||||
if(auraEffects.contains(effect) && aggravation.cumulative_damage_degrade) {
|
||||
SetupAggravationEntry(aggravation, data)
|
||||
}
|
||||
else if(obj.AddEffectToAura(effect).diff(auraEffects).contains(effect)) {
|
||||
|
|
@ -131,9 +132,9 @@ trait AuraEffectBehavior {
|
|||
case Some(list) => effectToEntryId -> (list :+ id)
|
||||
}
|
||||
//pair id with timer
|
||||
val inflictionRate = info.infliction_rate
|
||||
val inflictionRate = 1000 //info.infliction_rate
|
||||
val iterations = (aggravation.duration / inflictionRate).toInt
|
||||
val leftoverTime = aggravation.duration % inflictionRate
|
||||
val leftoverTime = aggravation.duration - (iterations * inflictionRate)
|
||||
entryIdToTimer += id -> context.system.scheduler.scheduleOnce(inflictionRate milliseconds, self, AuraEffectBehavior.Aggravate(id, iterations, leftoverTime))
|
||||
//pair id with entry
|
||||
PairIdWithAggravationEntry(id, effect, inflictionRate, data, data.target, Vector3.Zero)
|
||||
|
|
@ -212,7 +213,7 @@ trait AuraEffectBehavior {
|
|||
UpdateAggravatedEffect(AuraTargetObject)
|
||||
}
|
||||
|
||||
def UpdateAggravatedEffect(target: Player) : Unit = {
|
||||
def UpdateAggravatedEffect(target: AuraEffectBehavior.Target) : Unit = {
|
||||
import services.avatar.{AvatarAction, AvatarServiceMessage}
|
||||
val zone = target.Zone
|
||||
val value = target.Aura.foldLeft(0)(_ + _.id)
|
||||
|
|
@ -225,6 +226,8 @@ trait AuraEffectBehavior {
|
|||
}
|
||||
|
||||
object AuraEffectBehavior {
|
||||
type Target = PlanetSideServerObject with Vitality with AuraContainer
|
||||
|
||||
private case class Entry(id: Long, effect: Aura.Value, retime: Long, data: ResolvedProjectile)
|
||||
|
||||
private case class Aggravate(id: Long, iterations: Int, leftover: Long)
|
||||
Loading…
Add table
Add a link
Reference in a new issue