89 public function remove(
Effect $effectType) :
void{
90 $index = spl_object_id($effectType);
91 if(isset($this->effects[$index])){
92 $effect = $this->effects[$index];
94 unset($this->effects[$index]);
95 foreach($this->effectRemoveHooks as $hook){
99 $this->recalculateEffectColor();
124 $index = spl_object_id($effect->getType());
125 if(isset($this->effects[$index])){
126 $oldEffect = $this->effects[$index];
128 abs($effect->getAmplifier()) < $oldEffect->getAmplifier()
129 || (abs($effect->getAmplifier()) === abs($oldEffect->getAmplifier()) && $effect->
getDuration() < $oldEffect->getDuration())
144 if($this->canAdd($effect)){
145 $index = spl_object_id($effect->getType());
146 $replacesOldEffect = isset($this->effects[$index]);
148 $this->effects[$index] = $effect;
149 foreach($this->effectAddHooks as $hook){
150 $hook($effect, $replacesOldEffect);
153 $this->recalculateEffectColor();
177 foreach($this->effects as $effect){
178 if(($this->effectFilterForBubbles)($effect)){
179 $level = $effect->getEffectLevel();
180 $color = $effect->getColor();
181 for($i = 0; $i < $level; ++$i){
185 if(!$effect->isAmbient()){
191 if(count($colors) > 0){
192 $this->bubbleColor = Color::mix(...$colors);
193 $this->onlyAmbientEffects = $ambient;
195 $this->bubbleColor =
new Color(0, 0, 0, 0);
196 $this->onlyAmbientEffects =
false;