Experimental area-of-effect Seduction
authornemo
Sun, 07 Aug 2011 14:29:11 -0400
changeset 5525 5fb06333314e
parent 5524 40b7f95d9f18
child 5526 70a5ec7b1020
Experimental area-of-effect Seduction
hedgewars/GSHandlers.inc
hedgewars/uGears.pas
hedgewars/uGearsRender.pas
--- a/hedgewars/GSHandlers.inc	Sun Aug 07 22:27:57 2011 +0400
+++ b/hedgewars/GSHandlers.inc	Sun Aug 07 14:29:11 2011 -0400
@@ -2942,10 +2942,26 @@
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepSeductionWork(Gear: PGear);
 var 
-    x, y: LongInt;
+    x, y, i: LongInt;
+    hogs: TPGearArray;
+    d: hwFloat;
 begin
     AllInactive := false;
-
+    hogs := GearsNear(Gear^.X, Gear^.Y, gtHedgehog, Gear^.Radius);
+    if Length(hogs) > 0 then
+        begin
+        for i:= 0 to High(hogs) do
+            begin
+            //d:= Distance(Gear^.X - hogs[i]^.X, Gear^.Y - hogs[i]^.Y);
+            hogs[i]^.dX:= _0_25 * (Gear^.X - hogs[i]^.X) / _250;
+            //if Gear^.X < hogs[i]^.X then hogs[i]^.dX.isNegative:= true;
+            hogs[i]^.dY:= -_0_25;
+            hogs[i]^.Active:= true;
+            end;
+        end ;
+        AfterAttack;
+        DeleteGear(Gear);
+(*
     Gear^.X := Gear^.X + Gear^.dX;
     Gear^.Y := Gear^.Y + Gear^.dY;
     x := hwRound(Gear^.X);
@@ -2967,7 +2983,7 @@
         begin
         AfterAttack;
         DeleteGear(Gear)
-        end
+        end*)
 end;
 
 procedure doStepSeductionWear(Gear: PGear);
@@ -2989,7 +3005,7 @@
 procedure doStepSeduction(Gear: PGear);
 begin
     AllInactive := false;
-    DeleteCI(Gear^.Hedgehog^.Gear);
+    //DeleteCI(Gear^.Hedgehog^.Gear);
     Gear^.doStep := @doStepSeductionWear
 end;
 
--- a/hedgewars/uGears.pas	Sun Aug 07 22:27:57 2011 +0400
+++ b/hedgewars/uGears.pas	Sun Aug 07 14:29:11 2011 -0400
@@ -313,6 +313,9 @@
                 gear^.Elasticity:= _0_9;
                 gear^.Tag:= getRandom(32);
                 end;
+   gtSeduction: begin
+                gear^.Radius:= 250;
+                end;
  gtShotgunShot: begin
                 gear^.Timer:= 900;
                 gear^.Radius:= 2
--- a/hedgewars/uGearsRender.pas	Sun Aug 07 22:27:57 2011 +0400
+++ b/hedgewars/uGearsRender.pas	Sun Aug 07 14:29:11 2011 -0400
@@ -600,7 +600,10 @@
                 amGasBomb: DrawRotated(sprHandCheese, hx, hy, sign, aangle);
                 amMine: DrawRotated(sprHandMine, hx, hy, sign, aangle);
                 amSMine: DrawRotated(sprHandSMine, hx, hy, sign, aangle);
-                amSeduction: DrawRotated(sprHandSeduction, hx, hy, sign, aangle);
+                amSeduction: begin
+                             DrawRotated(sprHandSeduction, hx, hy, sign, aangle);
+                             DrawCircle(ox, oy, 240, 4, $FF, $00, $00, $AA); 
+                             end;
                 amVampiric: DrawRotatedF(sprHandVamp, hx, hy, (RealTicks div 125) mod 4, sign, aangle);
                 amRCPlane: begin
                     DrawRotated(sprHandPlane, hx, hy, sign, 0);