Bassebombecraft

Bassebombecraft

18.5k Downloads

Add contagion projectile modifier item

athrane opened this issue ยท 4 comments

commented

Final (and simple)semantics for the item:

Contagion2 operator

CoreOp

  • Reset state
  • If time
  • Then find living entities within range (and exclude using predicate)
    • exclude self (i.e. hasDifferentIds)
    • exclude if they have contagion (i.e. hasNotPotionEffect == Contagion)
  • Apply AoeEffectOp to each found living entity

The predicate function will exclude an entity if it already has contagion, i.e. it doesn't doesn't spread to already contagious entities.

Implementation detail: The predicate function is defined as (please notice the nice AND):

Function<Ports, Predicate<LivingEntity>> fnGetPredicate = p -> hasLivingEntitiesDifferentIds(
  applyV(fnGetTrueSource, p)).and(hasNotPotionEffect(CONTAGION_EFFECT.get()));

AoeEffectOp

  • Add contagion effect to target entity
  • And add a graphical effect

ContagionEffect potion effect

CoreOp (for spread of potion effect)

  • Then find living entities within range (and exclude using predicate)
    • exclude self (i.e. hasDifferentIds)
  • Apply AoeEffectOp to each found living entity

The predicate function will only exclude itself. Any effect (including Contagion) will effect spread to any entity. Even if it is already contagious.

AoeEffectOp (for spread of potion effect)

  • Find potion effect
  • If potion effect was found
  • Clone potion effect
  • And add a graphical effect
commented

Comparison with wildfire operator

CoreOp

Operators

  • ResetResult2()
  • IsFrequencyActive2(fnGetFrequency)
  • FindEntities2(fnGetSourcePos, fnGetWorld, fnGetPredicate, fnGetRange, getBcSetEntities1())
  • ApplyOperatorToEntity2(getFnGetEntities1(), bcSetTarget, lazyInitAoeEffectOp));

Semantics

  • Reset state
  • If time
  • then find entities within range (and exclude using predicate)
  • and apply AoeEffectOp to each found entity

AoeEffectOp

Implemented by WildfireEffect.splAoeEffectOp.

Operators

  • IsNot2(new IsEffectActive2(fnGetTarget, WILDFIRE_EFFECT.get()))
  • AddEffect2(fnGetTarget, getBcSetEffectInstance1(), WILDFIRE_EFFECT.get(), wildfireEffectDuration.get(), wildfireEffectAmplifier.get())
  • AddGraphicalEffectAtClient2(getFnGetEntity1(), getFnGetEntity2(), fnGetDuration, WILDFIRE)

Semantics

  • If wildfire effect isn't active on target entity
  • add wildfire effect to target entity
  • and add a graphical effect
commented

Discarded semantics for the item:

Contagion2 operator

CoreOp

  • Reset state
  • If time
  • Then find living entities within range (and exclude using predicate)
    • exclude self (i.e. hasDifferentIds)
    • exclude if they have contagion (i.e. hasNotPotionEffect == Contagion)
  • Apply AoeEffectOp to each found living entity

The predicate function will exclude an entity if it already has contagion, i.e. it doesn't doesn't spread to already contagious entities.

Implementation detail: The predicate function is defined as (please notice the nice AND):

Function<Ports, Predicate<LivingEntity>> fnGetPredicate = p -> hasLivingEntitiesDifferentIds(
  applyV(fnGetTrueSource, p)).and(hasNotPotionEffect(CONTAGION_EFFECT.get()));

AoeEffectOp

  • Add contagion effect to target entity
  • And add a graphical effect

ContagionEffect potion effect

CoreOp1 (for spread of contagion)

  • Reset state
  • If time
  • Then find living entities within range (and exclude using predicate)
    • exclude self (i.e. hasDifferentIds)
    • exclude if they have contagion (i.e. hasNotPotionEffect == Contagion)
  • Apply AoeEffectOp1 to each found living entity

The predicate function will only exclude itself. Any effect (including Contagion) will effect spread to any entity. Even if it is already contagious.

AoeEffectOp1 (for spread of contagion)

  • Add contagion effect to target entity
  • And add a graphical effect

CoreOp2 (for spread of potion effect)

  • Reset state
  • If time
  • Then find living entities within range (and exclude using predicate)
    • exclude self (i.e. hasDifferentIds)
  • Apply AoeEffectOp2 to each found living entity

The predicate function will only exclude itself. Any effect (including Contagion) will effect spread to any entity. Even if it is already contagious.

AoeEffectOp2 (for spread of potion effect)

  • Find potion effect which isn't contagion
    • Clone potion effect

CoreOp

  • Reset state
  • If time
  • Then find living entities within range (and exclude using predicate)
    • exclude self (i.e. hasDifferentIds)
  • Apply AoeEffectOp to each found living entity

The predicate function will only exclude itself. Any effect (including Contagion) will effect spread to any entity. Even if it is already contagious.

AoeEffectOp

  • Find potion effect which isn't contagion
    • Clone potion effect
  • Add contagion effect to target entity
  • And add a graphical effect
commented

Event more discarded semantics for the item:

Contagion2 operator

CoreOp

  • Reset state
  • If time
  • Then find living entities within range (and exclude using predicate)
    • exclude self (i.e. hasDifferentIds)
    • exclude if they have contagion (i.e. hasNotPotionEffect == Contagion)
  • Apply AoeEffectOp to each found living entity

The predicate function will exclude an entity if it already has contagion, i.e. it doesn't doesn't spread to already contagious entities.

Implementation detail: The predicate function is defined as (please notice the nice AND):

Function<Ports, Predicate<LivingEntity>> fnGetPredicate = p -> hasLivingEntitiesDifferentIds(
  applyV(fnGetTrueSource, p)).and(hasNotPotionEffect(CONTAGION_EFFECT.get()));

AoeEffectOp

  • Add contagion effect to target entity
  • And add a graphical effect

ContagionEffect potion effect

CoreOp (for spread of potion effect)

  • Reset state
  • If time
  • Then find living entities within range (and exclude using predicate)
    • exclude self (i.e. hasDifferentIds)
  • Apply AoeEffectOp to each found living entity

The predicate function will only exclude itself. Any effect (including Contagion) will effect spread to any entity. Even if it is already contagious.

AoeEffectOp (for spread of potion effect)

  • Find potion effect which isn't contagion
    • Clone potion effect

CoreOp

  • Reset state
  • If time
  • Then find living entities within range (and exclude using predicate)
    • exclude self (i.e. hasDifferentIds)
  • Apply AoeEffectOp to each found living entity

The predicate function will only exclude itself. Any effect (including Contagion) will effect spread to any entity. Even if it is already contagious.

AoeEffectOp

  • Find potion effect which isn't contagion
    • Clone potion effect
  • Add contagion effect to target entity
  • And add a graphical effect
commented

Resolved with commit: f5bee22