~armagetronad-ap/armagetronad/BattleMania

« back to all changes in this revision

Viewing changes to src/special/attack/interact.php

  • Committer: zodiacsohma1 at gmail
  • Date: 2014-03-07 04:20:29 UTC
  • Revision ID: zodiacsohma1@gmail.com-20140307042029-34oc5evovei40uik
Added #death_time variable to cycle.php
Renamed Attack functions to suitable names which make better sense and purpose.
Renamed KillTheKingInteract function to KillTheKingInteractAllowed for purposeful definition.
Renamed RandomColors function to RandomColorsRGB for purposeful definition.
Changed the integer value of DELAY_COMMAND function to float value.
Used BridgePieces function in config.php to grab values.
Simplify the chat string in chat.php for script memory check.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
###################################################################
9
9
 
10
10
//  kill the player and send the killed message
11
 
function AttackDefeatPlayer(Cycle $target, Player $attacker, Attack $attack, $kill = true)
 
11
function AttackInflictPlayer(Cycle $target, Player $attacker, Attack $attack, $kill = true)
12
12
{
13
13
    if ($kill)
14
14
    {
15
 
        con("0xff77ff".$target->player." got killed by ".strtolower($attacker)."'s ".strtolower($attack->name).".");
 
15
        con("0xff77ff".$target->player." is slain by ".strtolower($attacker)."'s ".strtolower($attack->name).".");
16
16
        $target->Kill();
17
17
    }
18
18
 
35
35
}
36
36
 
37
37
//  inflict the exp gain depending on the attack's offensive power factor
38
 
function AttackInflictPlayer(Player $attacker, Attack $attack)
 
38
function AttackRewardPlayer(Player $attacker, Attack $attack)
39
39
{
40
40
    $killer_record = getRecord($attacker->log);
41
41
    if ($attacker->human && isset($killer_record) && !is_null($killer_record) && ($killer_record instanceof Record))
45
45
        $gainExp   = $killer_record->experience->gainExp($attack->power_factor);
46
46
        $gainMoney = $killer_record->money->Gain($attack->power_factor);
47
47
 
48
 
        pm($attacker, "0xffcc77You got ".$gainExp." exp and $".$gainMoney." for attacking.");
 
48
        pm($attacker, "0xffcc77You attacked a player 0xRESETT[ ".$gainExp." exp, $".$gainMoney." ]");
49
49
 
50
50
        playerGainExp($attacker, $killer_record, $gainExp);
51
51
 
79
79
            //  stop attacks between team mates depending on the game mode
80
80
            if ($attacker->team == $target->team)
81
81
                return;
82
 
        }
83
82
 
84
 
        //  process the type of interaction in the frontier battles mode
85
 
        if (Base::$base->game_mode == 3)
86
 
        {
87
 
            if (KillTheKingInteract($attacker, $target->player, $attack))
88
 
                return;
 
83
            //  process the type of interaction in the frontier battles mode
 
84
            if (Base::$base->game_mode == 3)
 
85
            {
 
86
                if (!KillTheKingInteractAllowed($attacker, $target->player, $attack))
 
87
                    return;
 
88
            }
89
89
        }
90
90
 
91
91
        switch ($attack->log)
103
103
                $target->paralyzed_counter = 0;
104
104
                $target->paralyzed_lasttime = Base::$base->TIMER->gameTimer();
105
105
 
106
 
                SpawnExplosion($zone->pos, $attack->power_factor, Color::RandomColors());
 
106
                SpawnExplosion($zone->pos, $attack->power_factor, Color::RandomColorRGB());
107
107
                $zone->Collapse();
108
108
 
109
109
                SpawnSpeedZone("speed", 0, $target->pos, new Coord(), 3, $target->player->color, 0, false, 0, $target->paralyzed_name);
112
112
            case "exploders":
113
113
                if ($attacker == $target->player) return;
114
114
 
115
 
                SpawnExplosion($zone->pos, $attack->power_factor, Color::RandomColors());
 
115
                SpawnExplosion($zone->pos, $attack->power_factor, Color::RandomColorRGB());
116
116
                $zone->Collapse();
117
117
 
118
 
                AttackDefeatPlayer($target, $attacker, $attack);
119
 
                AttackInflictPlayer($attacker, $attack);
 
118
                AttackInflictPlayer($target, $attacker, $attack);
 
119
                AttackRewardPlayer($attacker, $attack);
120
120
                break;
121
121
 
122
122
            case "poison_dart":
123
123
                if ($attacker == $target->player) return;
124
124
 
125
 
                SpawnExplosion($zone->pos, $attack->power_factor, Color::RandomColors());
 
125
                SpawnExplosion($zone->pos, $attack->power_factor, Color::RandomColorRGB());
126
126
                $zone->Collapse();
127
127
 
128
128
                $target->poisoned = true;
129
129
                $target->poisoned_lasttime = Base::$base->TIMER->gameTimer();
130
130
 
131
131
                con($target->player->cname." 0xRESETTbecame poisoned.");
132
 
                AttackDefeatPlayer($target, $attacker, $attack, false);
 
132
                AttackInflictPlayer($target, $attacker, $attack, false);
133
133
 
134
134
                break;
135
135
 
136
136
            default:
137
137
                if ($attacker == $target->player) return;
138
138
 
139
 
                SpawnExplosion($zone->pos, $attack->power_factor, Color::RandomColors());
 
139
                SpawnExplosion($zone->pos, $attack->power_factor, Color::RandomColorRGB());
140
140
                $zone->Collapse();
141
141
 
142
142
                $rubber_lost = $attack->InflictDamage($attacker);
145
145
                if ($new_rubber >= $target->total_rubber)
146
146
                {
147
147
                    $new_rubber = $target->total_rubber;
148
 
                    AttackDefeatPlayer($target, $attacker, $attack);
 
148
                    AttackInflictPlayer($target, $attacker, $attack);
149
149
                }
150
150
                else
151
151
                {
153
153
                    if ($rem_rubber <= 0)
154
154
                    {
155
155
                        $new_rubber = $target->total_rubber;
156
 
                        AttackDefeatPlayer($target, $attacker, $attack);
 
156
                        AttackInflictPlayer($target, $attacker, $attack);
157
157
                    }
158
158
                    else
159
159
                    {
163
163
 
164
164
                $target->SetRubber($new_rubber);
165
165
 
166
 
                AttackInflictPlayer($attacker, $attack);
 
166
                AttackRewardPlayer($attacker, $attack);
167
167
                break;
168
168
        }
169
169
    }
179
179
            switch ($attack->log)
180
180
            {
181
181
                case "aqua_shield":
182
 
                    SpawnExplosion($target->pos, $attack->power_factor, Color::RandomColors());
 
182
                    SpawnExplosion($target->pos, $attack->power_factor, Color::RandomColorRGB());
183
183
                    $target->Collapse();
184
184
                    break;
185
185
 
186
186
                default:
187
 
                    SpawnExplosion($zone->pos, $attack->power_factor, Color::RandomColors());
188
 
                    SpawnExplosion($target->pos, $attack->power_factor, Color::RandomColors());
 
187
                    SpawnExplosion($zone->pos, $attack->power_factor, Color::RandomColorRGB());
 
188
                    SpawnExplosion($target->pos, $attack->power_factor, Color::RandomColorRGB());
189
189
 
190
190
                    $target->Collapse();
191
191
                    $zone->Collapse();
192
192
 
193
 
                    AttackInflictPlayer($attacker, $attack);
 
193
                    AttackRewardPlayer($attacker, $attack);
194
194
                    break;
195
195
            }
196
196
        }
215
215
                    case "aqua_shield":
216
216
                        if ($t_attack->log != $attack->log)
217
217
                        {
218
 
                            SpawnExplosion($target->pos, $attack->power_factor, Color::RandomColors());
 
218
                            SpawnExplosion($target->pos, $attack->power_factor, Color::RandomColorRGB());
219
219
                            $target->Collapse();
220
220
                        }
221
221
                        break;
222
222
 
223
223
                    default:
224
 
                        SpawnExplosion($zone->pos, $t_attack->power_factor, Color::RandomColors());
225
 
                        SpawnExplosion($target->pos, $attack->power_factor, Color::RandomColors());
 
224
                        SpawnExplosion($zone->pos, $t_attack->power_factor, Color::RandomColorRGB());
 
225
                        SpawnExplosion($target->pos, $attack->power_factor, Color::RandomColorRGB());
226
226
 
227
227
                        $target->Collapse();
228
228
                        $zone->Collapse();