public function CheckActiveAbilities(Game $Game) { foreach ($this->ActiveAbilities as $Key => $ActiveAbility) { if ($ActiveAbility->IsCooledDown($Game->Time)) { AbilityItem::HandleAbility($Game, $Game->GetLane($this->GetCurrentLane()), $this, $ActiveAbility, true); $this->RemoveActiveAbility($Key); } } }
public function CheckActivePlayerAbilities($Game, $SecondsPassed = 0) { $SecondPassed = $SecondsPassed > 0; $HealingPercentage = 0; $ClearCooldowns = false; $ActivePlayerAbilities = $this->ActivePlayerAbilities; foreach ($ActivePlayerAbilities as $Key => $ActiveAbility) { if ($ActiveAbility->IsDone($Game->Time)) { // TODO: @Contex: Remove whatever effects the ability had // TODO: @Contex: Do active abilities carry on over to the next lane? The logic below would fail if a player switches a lane.. AbilityItem::HandleAbility($Game, $this, null, $ActiveAbility, true); unset($this->ActivePlayerAbilities[$Key]); } else { if ($SecondPassed) { switch ($ActiveAbility->GetAbility()) { case Enums\EAbility::Support_Heal: $HealingPercentage += AbilityItem::GetMultiplier($ActiveAbility->GetAbility()); break; case Enums\EAbility::Item_ClearCooldowns: $ClearCooldowns = true; break; } } } } # TODO: Check if $HealingPercentage is 0.1% or 10%, 0.1% would make more sense if it stacks.. if ($SecondPassed) { $PlayersInLane = $Game->GetPlayersInLane($this->GetLaneId()); foreach ($PlayersInLane as $PlayerInLane) { // Check "Medics" & heal if ($HealingPercentage > 0 && !$PlayerInLane->IsDead()) { # TODO: Check if $HealingPercentage is 0.1% or 10%, 0.1% would make more sense if it stacks.. $PlayerInLane->IncreaseHp($PlayerInLane->GetTechTree()->GetMaxHp() * $HealingPercentage * $SecondsPassed); # TODO: GetHp() or GetTechTree()->GetMaxHp()? } // Clear player cooldowns if ($ClearCooldowns) { $PlayerInLane->ClearActiveAbilities(); } } } }