1527 |
1527 |
1528 function TestPiano(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams; Flags: LongWord): LongInt; |
1528 function TestPiano(Me: PGear; Targ: TTarget; Level: LongInt; var ap: TAttackParams; Flags: LongWord): LongInt; |
1529 const BOUNCES = 5; |
1529 const BOUNCES = 5; |
1530 var X, Y: real; |
1530 var X, Y: real; |
1531 dmg: array[0..BOUNCES-1] of LongInt; |
1531 dmg: array[0..BOUNCES-1] of LongInt; |
1532 i, valueResult: LongInt; |
1532 i, e, rate, valueResult: LongInt; |
1533 begin |
1533 begin |
1534 Flags:= Flags; // avoid compiler hint |
1534 Flags:= Flags; // avoid compiler hint |
1535 ap.ExplR:= 0; |
1535 ap.ExplR:= 0; |
1536 ap.Time:= 0; |
1536 ap.Time:= 0; |
1537 if (cGravityf <= 0) then |
1537 if (cGravityf <= 0) then |
1550 for i:= 0 to BOUNCES-1 do |
1550 for i:= 0 to BOUNCES-1 do |
1551 dmg[i]:= 0; |
1551 dmg[i]:= 0; |
1552 |
1552 |
1553 i:= 1; |
1553 i:= 1; |
1554 repeat |
1554 repeat |
1555 Y:= Y + 32; |
1555 // Piano goes down |
|
1556 Y:= Y + 11; |
1556 if TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(X), trunc(Y), 32) then |
1557 if TestCollExcludingMe(Me^.Hedgehog^.Gear, trunc(X), trunc(Y), 32) then |
1557 begin |
1558 begin |
1558 dmg[i]:= dmg[i] + RateExplosion(Me, trunc(X)-30, trunc(Y)+40, 161, afIgnoreMe); |
1559 for e:= -1 to 1 do |
1559 dmg[i]:= dmg[i] + RateExplosion(Me, trunc(X), trunc(Y)+40, 161, afIgnoreMe); |
1560 begin |
1560 dmg[i]:= dmg[i] + RateExplosion(Me, trunc(X)+30, trunc(Y)+40, 161, afIgnoreMe); |
1561 rate:= RateExplosion(Me, trunc(X) + 30*e, trunc(Y)+40, 161, afIgnoreMe); |
|
1562 if rate <> BadTurn then |
|
1563 dmg[i]:= dmg[i] + rate; |
|
1564 end; |
|
1565 |
|
1566 if (i > 1) and (dmg[i] > 0) then |
|
1567 dmg[i]:= dmg[i] div 2; |
1561 inc(i); |
1568 inc(i); |
1562 Y:= Y + 48; |
1569 // Skip past the blast hole |
1563 end; |
1570 Y:= Y + 41 |
1564 until (i >= BOUNCES) or (Y > cWaterLine); |
1571 end; |
|
1572 until (i > BOUNCES) or (Y > cWaterLine); |
1565 |
1573 |
1566 if (i = 0) and (Y > cWaterLine) then |
1574 if (i = 0) and (Y > cWaterLine) then |
1567 exit(BadTurn); |
1575 exit(BadTurn); |
1568 |
1576 |
1569 valueResult:= 0; |
1577 valueResult:= 0; |
1570 for i:= 0 to BOUNCES do |
1578 for i:= 0 to BOUNCES do |
1571 if dmg[i] <> BadTurn then |
1579 if dmg[i] <= BadTurn then |
|
1580 begin |
|
1581 valueResult:= BadTurn; |
|
1582 break; |
|
1583 end |
|
1584 else |
1572 inc(valueResult, dmg[i]); |
1585 inc(valueResult, dmg[i]); |
1573 ap.AttackPutX:= Targ.Point.X; |
1586 ap.AttackPutX:= Targ.Point.X; |
1574 |
1587 |
1575 valueResult:= valueResult - KillScore * friendlyfactor div 100 * 1024; |
1588 valueResult:= valueResult - KillScore * friendlyfactor div 100 * 1024; |
1576 |
1589 |