home *** CD-ROM | disk | FTP | other *** search
/ Game.EXE 2001 January / Game.EXE_01_2001.iso / demos / Blade of Darkness / data1.cab / Program_Executable_Files / Lib / pocimac.py < prev    next >
Encoding:
Python Source  |  2000-11-16  |  15.8 KB  |  552 lines

  1. import OnInitTake
  2. import ReadGSFile
  3. import Bladex
  4. import Actions
  5. import CharStats
  6. import whrandom
  7. import GenFX
  8. import Reference
  9. import AuxFuncs
  10.  
  11.  
  12. POTION_STATE_USED = 0
  13. POTION_STATE_UNUSED = 1
  14.  
  15. POTION_TYPE_EAT = 0
  16. POTION_TYPE_DRINK_RIGHT = 1
  17. POTION_TYPE_GULP = 2
  18. POTION_TYPE_DRINK_LEFT = 3
  19.  
  20. POWERUP_TYPE_LIFE = 0
  21. POWERUP_TYPE_ATTACK = 1
  22.  
  23. POWERUP_DEACTIVATED     = 2
  24. POWERUP_ACTIVATED = 1
  25.  
  26. #B_PARTICLE_GTYPE_BLEND=1
  27.  
  28.  
  29. def RestoreWounds(EntityName, woundfactor=0.0):
  30.     me= Bladex.GetEntity(EntityName)    
  31.     woundlist= []    
  32.     for i in range (32):
  33.         if me.GetWoundedZone(i):
  34.             woundlist.append(i)
  35.     
  36.     while len(woundlist) and len(woundlist)/11.0 > woundfactor:
  37.         if woundlist.count(3):
  38.             wound2clear= 3 # Head
  39.         elif whrandom.randint(0,1):
  40.             wound2clear= whrandom.choice(woundlist)
  41.         else:
  42.             wound2clear= woundlist[0]
  43.         me.SetWoundedZone(wound2clear, 0)
  44.         woundlist.remove(wound2clear)
  45.  
  46. def RestoreWoundsToLifeLevel(EntityName):
  47.     me= Bladex.GetEntity(EntityName)
  48.     woundfactor= 1.0- (me.Life / CharStats.GetCharMaxLife(me.Kind,me.Level))
  49.     RestoreWounds(EntityName, woundfactor)
  50.  
  51. class Pocima:
  52.     def __init__(self,pot):
  53.         self.Hand = 0
  54.         self.Estado = POTION_STATE_UNUSED
  55.         self.Increment = 25
  56.         self.MaxLife = 200
  57.         self.DrinkFunc = 0
  58.         self.DrinkFuncArguments = ()
  59.         self.Sonido=0
  60.         self.Type = POTION_TYPE_DRINK_RIGHT
  61.         self.OHand = ""        
  62.         self.PowerPotion = 0
  63.         self.TimeStartPowerPotion = 5.0
  64.         self.TimePowerPotion = 10.0
  65.         self.OldFDefense = 0.0
  66.         self.OldFAttack    = 0.0
  67.         self.FDefense = 4.0
  68.         self.FAttack = 4.0
  69.         self.PowerUpEstado = POWERUP_DEACTIVATED
  70.         self.LifePowerUpI = 0
  71.         self.LifePowerUp = 100
  72.         self.FadeDelta = (0.2 /60.0)
  73.         self.CuresPoison= 0
  74.  
  75.  
  76.     def IncrementLife(self):
  77.         UsedBy2 = Bladex.GetEntity(self.entity)
  78.         UsedBy = self        
  79.  
  80.         if (UsedBy.PowerUpEstado == POWERUP_ACTIVATED):
  81.             if (UsedBy.LifePowerUpI < UsedBy.LifePowerUp):
  82.                 life = UsedBy2.Life + 1.0
  83.  
  84.                 if life <= self.MaxLife:
  85.                     UsedBy.LifePowerUpI = UsedBy.LifePowerUpI + 1.0
  86.                     UsedBy2.Life =  life
  87.                     RestoreWoundsToLifeLevel(UsedBy2.Name)
  88.  
  89.                 timenext = 0.50
  90.  
  91.                 Bladex.AddScheduledFunc(Bladex.GetTime() + timenext,self.IncrementLife,())
  92.             else:
  93.                 UsedBy.PowerUpEstado = POTION_STATE_USED
  94.  
  95.     def ActivatePowerUp(self,sector,entity):        
  96.         #UsedBy = Bladex.GetEntity(entity)
  97.         UsedBy = self        
  98.         
  99.         if (UsedBy.PowerUpEstado == POWERUP_DEACTIVATED):            
  100.             self.entity = entity
  101.             UsedBy.PowerUpEstado = POWERUP_ACTIVATED
  102.             Bladex.AddScheduledFunc(Bladex.GetTime() + 0.50,self.IncrementLife,())
  103.  
  104.     def DeactivatePowerUp(self,sector,entity):        
  105.         if (entity == self.entity):
  106.             #UsedBy = Bladex.GetEntity(entity)
  107.             UsedBy = self
  108.  
  109.             if (UsedBy.PowerUpEstado == POWERUP_ACTIVATED):
  110.                 UsedBy.PowerUpEstado = POWERUP_DEACTIVATED
  111.  
  112.     def FinishPowerAtack(self,entity):        
  113.         UsedBy = Bladex.GetEntity(entity)
  114.         if UsedBy.Data.PowerPotion==1 :
  115.             UsedBy.SelfIlum = 0.0
  116.             UsedBy.Data.FDefense = self.OldFDefense
  117.             UsedBy.Data.FAttack = self.OldFAttack
  118.             UsedBy.Data.PowerPotion = 2
  119.  
  120.     def StartPowerAtack(self):    
  121.         if (self.PowerUpEstado == POWERUP_ACTIVATED):            
  122.             UsedBy = Bladex.GetEntity(self.entity)
  123.             UsedBy.SelfIlum = 1.0
  124.             self.OldFDefense = 1.0
  125.             self.OldFAttack = 1.0
  126.  
  127.             UsedBy.Data.FDefense = self.FDefense
  128.             UsedBy.Data.FAttack = self.FAttack
  129.             UsedBy.Data.PowerPotion = 1
  130.  
  131.             Bladex.AddScheduledFunc(Bladex.GetTime() + self.TimePowerPotion,self.FinishPowerAtack,(self.entity,))
  132.  
  133.     def ActivatePowerUpAtack(self,sector,entity):
  134.         if (self.PowerUpEstado == POWERUP_DEACTIVATED):
  135.             UsedBy = Bladex.GetEntity(entity)            
  136.  
  137.             if (UsedBy.Data.PowerPotion == 0):                
  138.                 self.PowerUpEstado = POWERUP_ACTIVATED
  139.                 self.entity = entity
  140.                 Bladex.AddScheduledFunc(Bladex.GetTime() + self.TimeStartPowerPotion,self.StartPowerAtack,())
  141.     
  142.     def DeactivatePowerUpAtack(self,sector,entity):
  143.         if (entity == self.entity):
  144.             self.PowerUpEstado = POWERUP_DEACTIVATED            
  145.  
  146.     def Reset(self,Players = 0):
  147.         #UsedBy = Bladex.GetEntity(self.entity)
  148.  
  149.         if (self.Type == POWERUP_TYPE_LIFE):
  150.             UsedBy = self
  151.  
  152.             UsedBy.PowerUpEstado = POWERUP_DEACTIVATED
  153.             UsedBy.LifePowerUpI = 0.0
  154.         else:
  155.             for name in Players:
  156.                 ent = Bladex.GetEntity(name)
  157.                 ent.Data.PowerPotion = 0
  158.                 ent.Data.FDefense = 1.0
  159.                 ent.Data.FAttack = 1.0
  160.                 ent.SelfIlum = 0.0
  161.  
  162.     def FadeOut(self,entity,timer):        
  163.         poc = Bladex.GetEntity(entity)
  164.         poc.Alpha = poc.Alpha - poc.Data.FadeDelta
  165.         if len(poc.Lights):
  166.             poc.Lights = [(poc.Alpha/2, poc.Lights[0][1], poc.Lights[0][2])]
  167.  
  168.         if poc.Alpha <= 0:
  169.             poc.SubscribeToList("Pin")
  170.  
  171. def RestoreHand(entidad):    
  172.     char = Bladex.GetEntity(entidad)
  173.     char.AddAnmEventFunc("ChangeREvent",Actions.ToggleWEvent)
  174.     char.LaunchAnmType("Chg_r")
  175.  
  176. def TakePotionUsed():
  177.     pass
  178.  
  179. def PocimaNoSoltada(entidad):
  180.     Reference.debugprint("PocimaNoSoltada")
  181.     char = Bladex.GetEntity(entidad)    
  182.     object = Bladex.GetEntity(char.Data.obj_used)
  183.     
  184.     if object.Data.Estado == POTION_STATE_USED:
  185.         SoltarPocima(entidad,0)
  186.     else:
  187.         object.ExcludeHitFor(char)
  188.         inv = char.GetInventory()
  189.  
  190.         if object.Data.Type == POTION_TYPE_DRINK_LEFT:
  191.             # In Combat and using left hand's second slot
  192.             inv.LinkLeftHand2("None")
  193.             impulse = char.Rel2AbsVector(1000.0 * object.Mass, -1000.0 * object.Mass, 0.0)
  194.             object.Impulse(impulse[0],impulse[1],impulse[2])
  195.         else:
  196.             inv.LinkRightHand("None")        
  197.             
  198.             if object.Data.Hand == 1:
  199.                 char.AnmEndedFunc = RestoreHand
  200.  
  201.             inv.RemoveObject(char.Data.obj_used)
  202.             impulse = char.Rel2AbsVector(-1000.0 * object.Mass, -1000.0 * object.Mass, 0.0)    
  203.             object.Impulse(impulse[0],impulse[1],impulse[2])    
  204.  
  205. def SoltarFood(Entidad):
  206.     char = Bladex.GetEntity(Entidad)
  207.     char.AnmEndedFunc = ""
  208.     inv = char.GetInventory()
  209.     inv.LinkRightHand("None")
  210.     inv.RemoveObject(char.Data.obj_used)        
  211.     Actions.TakeStraightRecover(Entidad)
  212.  
  213. def SoltarPocima(Entidad,Evento = 0):
  214.     char = Bladex.GetEntity(Entidad)
  215.     char.AnmEndedFunc = ""
  216.     if Evento:
  217.         char.DelAnmEventFunc(Evento)
  218.     object = Bladex.GetEntity(char.Data.obj_used)
  219.     object.ExcludeHitFor(char)
  220.     object.TimerFunc = object.Data.FadeOut
  221.     object.SubscribeToList("Timer60")
  222.  
  223.     inv = char.GetInventory()
  224.  
  225.     if object.Data.Type == POTION_TYPE_DRINK_LEFT:
  226.         # In Combat and using left hand's second slot
  227.         inv.LinkLeftHand2("None")
  228.         inv.RemoveObject(char.Data.obj_used)
  229.         impulse = char.Rel2AbsVector(1000.0 * object.Mass, -1000.0 * object.Mass, 0.0)
  230.         object.Impulse(impulse[0],impulse[1],impulse[2])
  231.     else:
  232.         inv.LinkRightHand("None")        
  233.         
  234.         if object.Data.Hand == 1:            
  235.             char.AnmEndedFunc = RestoreHand
  236.         else:
  237.             char.AnmEndedFunc= Actions.TakeStraightRecover
  238.         inv.RemoveObject(char.Data.obj_used)
  239.         impulse = char.Rel2AbsVector(-1000.0 * object.Mass, -1000.0 * object.Mass, 0.0)    
  240.         object.Impulse(impulse[0],impulse[1],impulse[2])
  241.  
  242.     OnInitTake.AddOnInitTakeEvent(object.Name,TakePotionUsed)
  243.     
  244.  
  245. def RestorePowerPotion(Entidad,Potion):
  246.     char = Bladex.GetEntity(Entidad)
  247.  
  248.     char.Data.FDefense = Potion.OldFDefense
  249.     char.Data.FAttack = Potion.OldFAttack
  250.     char.Data.PowerPotion = 0
  251.  
  252. def BeberPocima(Entidad,Evento):
  253.     char = Bladex.GetEntity(Entidad)
  254.     char.DelAnmEventFunc(Evento)
  255.     Poti = Bladex.GetEntity(char.Data.obj_used)
  256.     Pot = Poti.Data    
  257.     Pot.Estado = POTION_STATE_USED
  258.  
  259.     if (Pot.PowerPotion):        
  260.         Pot.OldFDefense = char.Data.FDefense
  261.         Pot.OldFAttack = char.Data.FAttack
  262.         
  263.         char.Data.FDefense = Pot.FDefense
  264.         char.Data.FAttack = Pot.FAttack
  265.         char.Data.PowerPotion = 1
  266.         Bladex.AddScheduledFunc(Bladex.GetTime() + Pot.TimePowerPotion,RestorePowerPotion,(Entidad,Pot))
  267.         GenFX.AddPersonItemFX(Entidad, Poti.Name, Pot.TimePowerPotion)
  268.     else:
  269.         if Pot.Increment == -1:
  270.             char.Life = CharStats.GetCharMaxLife(char.Kind,char.Level)
  271.             # Restore wounds
  272.             RestoreWounds(Entidad)
  273.         else:
  274.             Life = char.Life + Pot.Increment
  275.             LimitLife = CharStats.GetCharMaxLife(char.Kind,char.Level)
  276.  
  277.             if (Life > LimitLife):
  278.                 char.Life = LimitLife
  279.             else:
  280.                 char.Life = Life
  281.             RestoreWoundsToLifeLevel(Entidad)
  282.  
  283.         if Pot.CuresPoison:
  284.             char.Data.UnVenom ()
  285.             
  286.     Pot.Sonido.Play(char.Position[0],char.Position[1],char.Position[2],0)
  287.  
  288.     if (Pot.DrinkFunc <> 0):
  289.         Bladex.AddScheduledFunc(Bladex.GetTime(),Pot.DrinkFunc,Pot.DrinkFuncArguments)
  290.  
  291. def CreateMiguillas(Entidad,Evento):
  292.     char = Bladex.GetEntity(Entidad)    
  293.     Poti = Bladex.GetEntity(char.Data.obj_used)    
  294.  
  295.     miguillas=Bladex.CreateEntity("Miguillas", "Entity Particle System D1",0,0,0)
  296.     #miguillas.D=-3600, 0, 0
  297.     miguillas.ParticleType="Miguillas"
  298.     miguillas.YGravity=10000.0
  299.     miguillas.Friction=0.2
  300.     miguillas.RandomVelocity=10.0
  301.     miguillas.PPS=200
  302.     miguillas.Time2Live=32
  303.     miguillas.DeathTime=Bladex.GetTime() + 0.1
  304.  
  305.     Poti.Link(miguillas)
  306.     
  307.     if Evento == "Bocado1Event":        
  308.         Poti.TimerFunc = Poti.Data.FadeOut
  309.         Poti.SubscribeToList("Timer60")
  310.  
  311.     #Pot.Estado = POTION_STATE_UNUSED
  312.  
  313.  
  314. def UsePotion3(Entity):    
  315.     char = Bladex.GetEntity(Entity)    
  316.     UsePotion2(char.Data.obj_used)
  317.  
  318. def UsePotion2(NombrePocima):    
  319.     Reference.debugprint("UsePotion2")        
  320.     Pocima = Bladex.GetEntity(NombrePocima)
  321.     #Pocima.Data.Estado = POTION_STATE_USED
  322.     Char = Bladex.GetEntity(Pocima.Data.UsedBy)
  323.     Reference.debugprint(Char.AnmEndedFunc)
  324.     #Char.HitFunc = TirarPocima    
  325.     Char.AnmEndedFunc= Actions.TakeStraightRecover
  326.  
  327.     if (Pocima.Data.Type==POTION_TYPE_EAT):        
  328.         Char.LaunchAnmType("eat00")
  329.         Char.AddAnmEventFunc("Bocado1Event",CreateMiguillas)
  330.         Char.AddAnmEventFunc("Bocado2Event",CreateMiguillas)
  331.         Char.AnmEndedFunc= SoltarFood
  332.     elif (Pocima.Data.Type == POTION_TYPE_DRINK_RIGHT):
  333.         Char.LaunchAnmType("drink")    
  334.         Char.AddAnmEventFunc("PickBottle",PickPotion)
  335.     elif (Pocima.Data.Type == POTION_TYPE_GULP):
  336.         Char.LaunchAnmType("gulp00")    
  337.     else:
  338.         print 'Unknown Potion Type' + `Pocima.Data.Type`
  339.  
  340.     Char.AddAnmEventFunc("drinkingEvent",BeberPocima)
  341.     print 'should throw bottle with event ThrowBottle in animation '+Char.AnimName
  342.     Char.AddAnmEventFunc("ThrowBottle",SoltarPocima)
  343.     
  344. def TryToUsePotion(me, object):
  345.     if not Reference.HealthIncrease.has_key(object.Kind):
  346.         return 1
  347.  
  348.     if Reference.DefaultObjectData[object.Kind][0] == Reference.OBJ_ITEM:
  349.         return 1
  350.     
  351.     return CanIUseThePotion(me, object)
  352.  
  353. def CanIUseThePotion(me, object):
  354.     if CharStats.GetCharMaxLife(me.Kind,me.Level) <= me.Life:
  355.         if me.Name == "Player1":
  356.             import GameText
  357.             import MenuText
  358.         
  359.             GameText.WriteTextAux(MenuText.GetMenuText("I don't need it, yet"),2.0,255,255,255,[])
  360.         return 0
  361.     else:
  362.         return 1
  363.  
  364. Actions.TryToTakeCallBacks.append(TryToUsePotion)
  365.   
  366. def UsePotion(NombrePocima,TipoUso):
  367.     Pocima = Bladex.GetEntity(NombrePocima)
  368.     Char = Bladex.GetEntity(Pocima.Data.UsedBy)
  369.     
  370.     if Reference.HealthIncrease.has_key(Pocima.Kind):
  371.         if not CanIUseThePotion(Char,Pocima):
  372.             return
  373.     
  374.     Pocima.Data.Hand = 0
  375.     Char.Data.obj_used = NombrePocima    
  376.     Char.AnmEndedFunc = PocimaNoSoltada
  377.     
  378.  
  379.     if (TipoUso == Actions.USE_FROM_INV and Pocima.Data.Estado == POTION_STATE_UNUSED):
  380.         # Use from inventory        
  381.         Pocima.Data.Type = 1
  382.         if not Char.InvRight:
  383.             UsePotion2(NombrePocima)
  384.         else:
  385.             if Char.InCombat:
  386.                 if not Char.InvLeft2:
  387.                     Pocima.Data.Type = 3                    
  388.                     Char.LaunchAnmType("attack_drink")
  389.                     Char.AddAnmEventFunc("PickBottle",PickPotion)
  390.                     Char.AddAnmEventFunc("drinkingEvent",BeberPocima)        
  391.                     Char.AddAnmEventFunc("ThrowBottle",SoltarPocima)
  392.  
  393.             elif Actions.IsRightHandStandardObject(Char.Name):
  394.                 if Actions.TryDropRight(Char.Name):    
  395.                     Actions.DropReleaseEventHandler(Char.Name, "DropRightEvent")
  396.                 if not Char.InvRight:                    
  397.                     UsePotion2(NombrePocima)
  398.             else:
  399.                 Char.AddAnmEventFunc("ChangeREvent",Actions.ToggleWEvent)
  400.                 Char.LaunchAnmType("Chg_r")
  401.                 Pocima.Data.Hand = 1
  402.                 Pocima.Data.OHand = Char.InvRight
  403.                 Char.AnmEndedFunc=UsePotion3
  404.     elif (TipoUso == Actions.USE_FROM_TAKE and Pocima.Data.Estado == POTION_STATE_UNUSED):
  405.         # Automatic use from take         
  406.         
  407.         if (Pocima.Data.Type <> POTION_TYPE_EAT):            
  408.             Pocima.Data.Type = POTION_TYPE_GULP
  409.             Char.AnmEndedFunc=UsePotion3
  410.         else:            
  411.             Char.AnmEndedFunc=UsePotion3
  412.  
  413.  
  414. def PickPotion(Entidad,Evento):
  415.     char=Bladex.GetEntity(Entidad)
  416.     char.DelAnmEventFunc(Evento)
  417.     Pocima = char.Data.obj_used        
  418.     object = Bladex.GetEntity(char.Data.obj_used)
  419.  
  420.     inv = char.GetInventory()
  421.     if object.Data.Type==3:
  422.         inv.LinkLeftHand2(Pocima)
  423.     else:
  424.         inv.LinkRightHand(Pocima)
  425.  
  426. def CreatePotion(Nombre,Increment = 25,MaxLife = 180):
  427.     Pot = Bladex.GetEntity(Nombre)
  428.     Pot.Static = 0
  429.     Pot.Data = Pocima(Pot)
  430.     Pot.UseFunc = UsePotion    
  431.     Pot.Data.Increment = Increment
  432.     Pot.Data.MaxLife = MaxLife
  433.     
  434.     if Reference.HealthIncrease.has_key(Pot.Kind):
  435.         Pot.Data.Increment   = Reference.HealthIncrease[Pot.Kind][0]
  436.         Pot.Data.CuresPoison = Reference.HealthIncrease[Pot.Kind][1]
  437.     
  438.     Pot.Data.Sonido = Bladex.CreateSound('..\\..\\Sounds\\Drink.wav', 'Drinking')
  439.     Pot.Data.Sonido.Volume=1
  440.     Pot.Data.Sonido.MinDistance=10000
  441.     Pot.Data.Sonido.MaxDistance=20000
  442.     
  443.     return Pot.Data
  444.  
  445.  
  446. def CreateFood(Nombre,Increment = 25,MaxLife = 180):
  447.     Pot = Bladex.GetEntity(Nombre)
  448.     Pot.Static = 0
  449.     Pot.Data = Pocima(Pot)
  450.     Pot.UseFunc = UsePotion
  451.     Pot.Data.Increment = Increment
  452.     Pot.Data.MaxLife = MaxLife
  453.  
  454.     Pot.Data.Type = POTION_TYPE_EAT    
  455.     Pot.Data.Sonido = Bladex.CreateSound('..\\..\\Sounds\\bugbite-bone2.wav', 'Eating')
  456.     #Pot.Data.Sound = Bladex.CreateSound('..\\..\\Sounds\\Drink.wav', 'Drinking')
  457.     Pot.Data.Sonido.Volume=1
  458.     Pot.Data.Sonido.MinDistance=10000
  459.     Pot.Data.Sonido.MaxDistance=20000
  460.     
  461.     Pot.Data.FadeDelta = (0.8 /60.0)
  462.     
  463.     if Reference.HealthIncrease.has_key(Pot.Kind):
  464.         Pot.Data.Increment   = Reference.HealthIncrease[Pot.Kind][0]
  465.         Pot.Data.CuresPoison = Reference.HealthIncrease[Pot.Kind][1]
  466.     
  467.     return Pot.Data
  468.  
  469. def CreatePowerPotion(Nombre,FD = 4.0,FA = 4.0,Time = 10):
  470.     PowerPot = CreatePotion(Nombre)
  471.     PowerPot.TimePowerPotion = Time
  472.     PowerPot.PowerPotion = 1
  473.     PowerPot.FDefense = FD
  474.     PowerPot.FAttack = FA
  475.     PowerPot.Increment = 0
  476.     PowerPot.CuresPoison = 0
  477.     pp                = Bladex.GetEntity(Nombre)
  478.     pp.FiresIntensity = [ 45 ]
  479.     pp.Lights         = [ (0.50000,0.050000,(0,128,255)) ]
  480.     pp.SelfIlum       = 1    
  481.     spot = AuxFuncs.GetSpot(pp)
  482.     if spot:
  483.         spot.Visible      = 0
  484.         spot.CastShadows  = 0
  485.     
  486.  
  487.  
  488.  
  489. def CreatePowerUp(Sector,Name,Life = 100,MaxLife = 100):
  490.     res=ReadGSFile.ReadGhostSectorFile(Sector)
  491.  
  492.     for igs in res:
  493.         Bladex.AddTriggerSector(igs["Name"],igs["Grupo"],igs["FloorHeight"],igs["RoofHeight"],igs["Vertex"])
  494.  
  495.     PowerUp = Pocima(0)
  496.  
  497.     Bladex.SetTriggerSectorFunc(Name, "OnLeave", PowerUp.DeactivatePowerUp)
  498.     Bladex.SetTriggerSectorFunc(Name, "OnEnter", PowerUp.ActivatePowerUp)
  499.     
  500.     PowerUp.Type = POWERUP_TYPE_LIFE
  501.     PowerUp.LifePowerUp = Life
  502.     PowerUp.MaxLife = MaxLife
  503.  
  504.     return PowerUp
  505.  
  506. def CreatePowerUpAtack(Sector,Name,FD = 4.0,FA = 4.0,TimeD = 10,TimeL = 5):
  507.     res=ReadGSFile.ReadGhostSectorFile(Sector)
  508.  
  509.     for igs in res:
  510.         Bladex.AddTriggerSector(igs["Name"],igs["Grupo"],igs["FloorHeight"],igs["RoofHeight"],igs["Vertex"])
  511.  
  512.     PowerUp = Pocima(0)
  513.  
  514.     Bladex.SetTriggerSectorFunc(Name, "OnLeave", PowerUp.DeactivatePowerUpAtack)
  515.     Bladex.SetTriggerSectorFunc(Name, "OnEnter", PowerUp.ActivatePowerUpAtack)
  516.  
  517.     PowerUp.Type = POWERUP_TYPE_ATTACK
  518.     PowerUp.TimeStartPowerPotion = TimeL
  519.     PowerUp.TimePowerPotion = TimeD        
  520.     PowerUp.FDefense = FD
  521.     PowerUp.FAttack = FA
  522.  
  523.  
  524.     return PowerUp
  525.  
  526.  
  527. def CreateDefaultPocimac(ObjectName):
  528.     obj = Bladex.GetEntity(ObjectName)
  529.  
  530.     # check for Power Potions
  531.     if obj.Kind == "PowerPotion":
  532.         CreatePowerPotion(ObjectName)
  533.         return 1
  534.  
  535.     # check for other stuff of PociMacs
  536.     if not Reference.HealthIncrease.has_key(obj.Kind):
  537.         return 0
  538.  
  539.     # check for Food
  540.     if Reference.HealthIncrease[obj.Kind][2] == Reference.POCIMAC_FOOD:
  541.         CreateFood(ObjectName)
  542.         return 1
  543.     
  544.     # check for Potions
  545.     if Reference.HealthIncrease[obj.Kind][2] == Reference.POCIMAC_POTION:
  546.         CreatePotion(ObjectName)
  547.         return 1
  548.     
  549.     print "FATAL ERROR: The PociMac type is not defined, yet."
  550.     return 0
  551.     
  552.