Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //! zinc
- library Attribute requires TimerUtils,GroupUtils,AutoIndex{
- constant real HEALTH_SCALE = 175;
- //constant real HEALTH_REGEN_SCALE = 1.02;
- constant real MANA_SCALE = 150;
- //constant real MANA_REGEN_SCALE = 0.45;
- constant integer ATTACK_DAMAGE_SCALE = 8;
- constant integer ARMOR_SCALE = 2;
- constant integer TITAN_UPGRADE = 'R052';
- //Will update with new natives for health and mana as released.
- constant integer MAX_ITEM = 1;
- integer Item_ID[8190];
- integer Item_Stat[1000][3];
- integer Bonus_Stat[8190][3];
- //1 == Might
- //2 == Dexterity
- //3 == Wisdom
- function setItemStats()->boolean{
- Item_ID[1]='rat9';
- Item_Stat[1][1]=25;
- Item_Stat[1][2]=25;
- Item_Stat[1][3]=0;
- return false;
- }
- function UnitHasItemType(unit whichUnit,integer itemId)->boolean{
- integer i=0;
- while (i>=bj_MAX_INVENTORY){
- if (GetItemTypeId(UnitItemInSlot(whichUnit,i))==itemId){
- return true;
- }
- i+=1;
- }
- return false;
- }
- function onCondition()->boolean{
- return IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO);
- }
- function updateHeroStat()->boolean{
- unit u=null;
- group g=NewGroup();
- integer i=1;
- integer id;
- integer a[];
- boolexpr b=Filter(function onCondition);
- GroupEnumUnitsInArea(g,0.0,0.0,10000,b);
- DestroyBoolExpr(b);
- u=FirstOfGroup(g);
- while (u!=null){
- while (1>=MAX_ITEM){
- if (UnitHasItemType(u,Item_ID[i])==true){
- a[1]+=Item_Stat[i][1];
- a[2]+=Item_Stat[i][2];
- a[3]+=Item_Stat[i][3];
- }
- }
- id=GetUnitId(u);
- SetHeroStr(u,a[1]+Bonus_Stat[id][1],true);
- SetHeroAgi(u,a[2]+Bonus_Stat[id][2],true);
- SetHeroInt(u,a[3]+Bonus_Stat[id][3],true);
- GroupRemoveUnit(g,u);
- u=FirstOfGroup(g);
- }
- ReleaseGroup(g);
- u=null;
- b=null;
- g=null;
- return false;
- }
- function onLevel()->boolean{
- unit u=GetTriggerUnit();
- player p=GetOwningPlayer(u);
- real HM=GetUnitState(u,UNIT_STATE_MAX_LIFE);
- //real HR=GetUnitState(u,UNIT_STATE_LIFE_REGEN);
- real MM=GetUnitState(u,UNIT_STATE_MAX_MANA);
- //real MR=GetUnitState(u,UNIT_STATE_MANA_REGEN);
- if (GetUnitTypeId(u)=='E01D'){
- BlzSetUnitBaseDamage(u,BlzGetUnitBaseDamage(u,1)+ATTACK_DAMAGE_SCALE,1);
- BlzSetUnitArmor(u,BlzGetUnitArmor(u)+ARMOR_SCALE);
- SetUnitState(u,UNIT_STATE_MAX_LIFE,HM+HEALTH_SCALE);
- //SetUnitState(u,UNIT_STATE_LIFE_REGEN,HR+HEALTH_REGEN_SCALE);
- SetUnitState(u,UNIT_STATE_MAX_MANA,MM+MANA_SCALE);
- //SetUnitState(u,UNIT_STATE_MANA_REGEN,MR+MANA_REGEN_SCALE);
- }
- return false;
- }
- function onInit(){
- trigger t=CreateTrigger();
- TriggerRegisterAnyUnitEventBJ(t,EVENT_PLAYER_HERO_LEVEL);
- TriggerAddCondition(t,Filter(function onLevel));
- t=CreateTrigger();
- TriggerRegisterTimerEventPeriodic(t,0.10);
- TriggerAddCondition(t,Filter(function updateHeroStat));
- t=null;
- }
- }
- //! endzinc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement