如何在不同页面的代码中集中条件调整?

I own and develop an text-browser online MMORPG, I plan on introducing a perk system with at least 20+ perks, these parks basically tweak some stuff, for example a perk that gives 5% discount on goodies you buy, or a perk that gives you 10% more chance on killing your enemy or a perk that increases your health by a small factor.. These parks all will be coded in different pages, for example the discount perk will need to be coded in a page called (shop.php) the others need to be coded in different pages

The problem that lays is this is not centralized. These will be code chunks all over different pages and if incase we wanted to remove them it would be hell. I was wondering if there would be a way to centralize all this. Off the top of my head, we'll have a perks table which will include all the perks.. Is there anyway to centralize such a thing? What would be the best way to centralize tweaks in the code?

As a simple example, the perk that increases your chance would do this in attack.php

$chance = BattlePvP($player_id);
if(PerkEquipped($player_id, "INCREASECHANCE")) $chance += $perk_increase;

These would be scattered all over the code.. So the question is How to centralize conditional tweaks in the code over different pages?

You'd have a method on the base class (or player directly) like modifyChance(chance) which checks if the perk is equipped, and if so, returns the increased chance otherwise returns the chance value passed in.

The code above thus becomes:

$chance = modifyChance(BattlePvP($player_id));

You can use a decorator pattern. A decorator is often use to decorate objects for example a pizza can have many different tops.