~armagetronad-ap/armagetronad/BattleMania

« back to all changes in this revision

Viewing changes to src/special/bag.php

  • Committer: zodiacsohma1 at gmail
  • Date: 2014-03-02 08:09:55 UTC
  • Revision ID: zodiacsohma1@gmail.com-20140302080955-r5ot6eipfe0nlpww
Simplified all fields and code in all areas for better as they seem to repeat themselves.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
        {
27
27
            foreach (Attack::$attacks as $attack)
28
28
            {
29
 
                if (isset($attack) && !is_null($attack) && $attack instanceof Attack && ($this->record->experience->level == $attack->level))
 
29
                if (isset($attack) && $attack instanceof Attack && ($this->record->experience->level == $attack->level))
30
30
                {
31
31
                    $attacks_limit = getSetting("ATTACKS_LIMIT");
32
32
                    if (count($this->attacks) < $attacks_limit->value)
45
45
        {
46
46
            foreach ($this->attacks as $attack)
47
47
            {
48
 
                if (isset($attack) && !is_null($attack) && $attack instanceof Attack && ($attack->log == Filter($name)))
 
48
                if (isset($attack) && $attack instanceof Attack && ($attack->log == Filter($name)))
49
49
                    return true;
50
50
            }
51
51
        }
59
59
        {
60
60
            foreach ($this->attacks as $attack)
61
61
            {
62
 
                if (isset($attack) && !is_null($attack) && $attack instanceof Attack && ($attack->log == Filter($name)))
 
62
                if (isset($attack) && $attack instanceof Attack && ($attack->log == Filter($name)))
63
63
                    return $attack;
64
64
            }
65
65
        }
73
73
        {
74
74
            foreach ($this->attacks as $attack)
75
75
            {
76
 
                if (isset($attack) && !is_null($attack) && $attack instanceof Attack)
 
76
                if (isset($attack) && $attack instanceof Attack)
77
77
                {
78
78
                    $attack->activate = true;
79
79
                    $attack->cooldown_counters = 0;
87
87
    {
88
88
        foreach ($this->attacks as $attack)
89
89
        {
90
 
            if (isset($attack) && !is_null($attack) && $attack instanceof Attack && (($time - $attack->cooldown_timestep) >= 1) && ($attack->cooldown > 0) && !$attack->activate)
 
90
            if (isset($attack) && $attack instanceof Attack && (($time - $attack->cooldown_timestep) >= 1) && ($attack->cooldown > 0) && !$attack->activate)
91
91
            {
92
92
                $attack->cooldown_counters += 1;
93
93
 
109
109
        {
110
110
            foreach ($this->items as $item)
111
111
            {
112
 
                if (isset($item) && !is_null($item) && $item instanceof Item && ($item->log == Filter($name)))
 
112
                if (isset($item) && $item instanceof Item && ($item->log == Filter($name)))
113
113
                    return true;
114
114
            }
115
115
        }
123
123
        {
124
124
            foreach ($this->items as $item)
125
125
            {
126
 
                if (isset($item) && !is_null($item) && $item instanceof Item && ($item->log == Filter($name)))
 
126
                if (isset($item) && $item instanceof Item && ($item->log == Filter($name)))
127
127
                    return $item;
128
128
            }
129
129
        }