罗喉

当前问题:令body.alpha = 0.5 后,会变得很卡,同时当执行到其他动作帧的时候alpha会自动恢复到1。

  1 package export.monster 
  2 {
  3     import base.*;
  4     import com.greensock.*;
  5     import event.*;
  6     import export.bullet.*;
  7     import export.hero.*;
  8     import manager.*;
  9     import my.*;
 10     import user.*;
 11     
 12     public class Monster46 extends base.BaseMonster
 13     {
 14         public function Monster46()
 15         {
 16             this.wuDi = false;
 17             hasZhaoHuanPoYaZhi = false;
 18             this.control = false;
 19             this.flyBulletArray = new Array();
 20             eyes = 0;
 21             var loc1:*=null;
 22             super();
 23             this.isBoss = true;
 24             this.monsterName = "罗喉";
 25             this.horizenSpeed = 9;
 26             var loc2:*=true;
 27             var loc3:*=gc.getPlayerArray();
 28             var loc4:*=0;
 29             while (loc4 < loc3.length) 
 30             {
 31                 if ((loc1 = loc3[loc4] as base.BaseHero).roleProperies.getLevel() > 15) 
 32                 {
 33                     loc2 = false;
 34                     break;
 35                 }
 36                 ++loc4;
 37             }
 38             this.protectedParamsObject.Hp = 200000;
 39             this.protectedParamsObject.def = 433;
 40             this.protectedParamsObject.mDef = 0.4;
 41             this.protectedParamsObject.sHp = this.protectedParamsObject.Hp;
 42             this.attackBackInfoDict["hit1"] = {"hitMaxCount":99, "attackBackSpeed":[6, -5], "attackInterval":4, "power":650, "attackKind":"physics"};
 43             this.attackBackInfoDict["hit2"] = {"hitMaxCount":30, "attackBackSpeed":[2, -7], "attackInterval":4, "power":670, "attackKind":"physics"};
 44             this.attackBackInfoDict["hit3"] = {"hitMaxCount":40, "attackBackSpeed":[2, -4], "attackInterval":4, "power":780, "attackKind":"magic"};
 45             this.attackBackInfoDict["hit4"] = {"hitMaxCount":30, "attackBackSpeed":[8, -2], "attackInterval":4, "power":750, "attackKind":"magic"};
 46             this.protectedParamsObject.mysee = 300;
 47             this.protectedParamsObject.isattback = 50;
 48             this.attackRange = 180;
 49             this.protectedParamsObject.exp = 100;
 50             this.protectedParamsObject.gxp = 80;
 51             this.protectedParamsObject.stoneFallRate = 1;
 52             this.protectedParamsObject.probability = 1;
 53             this.fallList = [{"name":"xhmt", "bigtype":"zb"}];
 54             return;
 55         }
 56 
 57         public override function beAttack(arg1:base.BaseHero):void
 58         {
 59             if (this.wuDi)
 60             return;
 61             var param1:base.BaseHero;
 62             var _target:base.BaseHero;
 63             var m:int;
 64             var bb:base.BaseBullet;
 65             var obj:Object;
 66             var hurt:int;
 67             var basehurt:int;
 68             var isCrit:Boolean;
 69             var lastint:int;
 70             var equip:my.MyEquipObj;
 71             var bloodRate:Number;
 72             var stunRate:Number;
 73             var loc1:*;
 74             var loc2:*;
 75             var loc3:*;
 76             var arg1:base.BaseHero;
 77 
 78             var loc1:*;
 79             param1 = arg1;
 80             _target = null;
 81             m = 0;
 82             bb = null;
 83             obj = null;
 84             hurt = 0;
 85             basehurt = 0;
 86             isCrit = false;
 87             lastint = 0;
 88             equip = null;
 89             bloodRate = NaN;
 90             stunRate = NaN;
 91             loc1 = undefined;
 92             loc2 = undefined;
 93             loc3 = undefined;
 94             arg1 = param1;
 95             if (this.curAction == "hit4") 
 96             {
 97                 if (eyes < 2) 
 98                 {
 99                     var loc2:*;
100                     eyes++;
101                     my.MainGame.getInstance().createMonster(662, this.x, this.y - 500);
102                 }
103             }
104             if (!hasZhaoHuanPoYaZhi && this.protectedParamsObject.Hp < 200000) 
105             {
106                 my.MainGame.getInstance().createMonster(664, this.x, this.y);
107                 hasZhaoHuanPoYaZhi = true;
108             }
109             if (this.protectedParamsObject.Hp < this.protectedParamsObject.sHp) 
110             {
111                 ++this.protectedParamsObject.Hp;
112             }
113             m = 0;
114             bb = null;
115             obj = null;
116             hurt = 0;
117             basehurt = 0;
118             isCrit = false;
119             lastint = 0;
120             equip = null;
121             bloodRate = NaN;
122             stunRate = NaN;
123             _target = arg1;
124             if (_target.body) 
125             {
126                 if (_target.body.stick) 
127                 {
128                     m = 0;
129                     while (m < this.magicBulletArray.length) 
130                     {
131                         bb = this.magicBulletArray[m] as base.BaseBullet;
132                         if (bb.isCanBeAttack) 
133                         {
134                             if (bb.hitTestObject(_target.body.stick)) 
135                             {
136                                 bb.setDisable();
137                                 com.greensock.TweenMax.to(bb, 1, {"alpha":0, "onCompleteParams":[bb], "onComplete":function (arg1:*):*
138                                 {
139                                     arg1.destroy();
140                                     return;
141                                 }})
142                             }
143                         }
144                         ++m;
145                     }
146                 }
147             }
148             if (this.beAttackIdArray.indexOf(_target.getAttackId()) != -1) 
149             {
150                 return;
151             }
152             if (this.isBoss && this.curAction == "dead") 
153             {
154                 return;
155             }
156             if (gc.protectedPerproty.getProperty(this, "isYourFather")) 
157             {
158                 return;
159             }
160             if (_target.body && this.colipse) 
161             {
162                 if (_target.body.stick) 
163                 {
164                     if (my.HitTest.complexHitTestObject(this.colipse, _target.body.stick)) 
165                     {
166 
167                         loc2 = loc2 = user.User;
168                         loc3 = (loc2.batterNum + 1);
169                         loc2.batterNum = loc3;
170                         this.isattack = true;
171                         if (_target is export.hero.Role2Shadow) 
172                         {
173                             this.curAttackTarget = export.hero.Role2Shadow(_target).source;
174                         }
175                         else 
176                         {
177                             this.curAttackTarget = _target;
178                         }
179                         if (_target is export.hero.Role1) 
180                         {
181                             manager.SoundManager.play("BeattackByRole1");
182                         }
183                         else if (_target is export.hero.Role2 || _target is export.hero.Role2Shadow) 
184                         {
185                             manager.SoundManager.play("BeattackByRole2");
186                         }
187                         this.drawMonsterHp();
188                         this.showHpSlip();
189                         obj = _target.attackBackInfoDict[_target.curAction];
190                         hurt = _target.getRealPower(_target.lastHit);
191                         basehurt = _target.getRealPower(_target.lastHit, false);
192                         isCrit = false;
193                         if (hurt / basehurt > 1.9) 
194                         {
195                             isCrit = true;
196                         }
197                         lastint = this.getRealHurt(hurt, obj);
198                         if (obj && obj.attackKind == "physics") 
199                         {
200                             if (_target is export.hero.Role1) 
201                             {
202                                 equip = _target.getPlayer().getCurEquipByType("zbwq");
203                                 if (equip) 
204                                 {
205                                     if (equip.fillName == "gwj" || equip.fillName == "ryjgb") 
206                                     {
207                                         bloodRate = base.BaseHero(_target).roleProperies.getproperiesObj().eatblood;
208                                         _target.cureHp(2);
209                                     }
210                                 }
211                             }
212                         }
213                         if (obj && obj.attackKind == "physics") 
214                         {
215                             if (_target is export.hero.Role3) 
216                             {
217                                 equip = _target.getPlayer().getCurEquipByType("zbwq");
218                                 if (equip) 
219                                 {
220                                     if (equip.fillName == "ssc" || equip.fillName == "jcdp") 
221                                     {
222                                         stunRate = base.BaseHero(_target).roleProperies.getproperiesObj().deephit;
223                                         if (Math.random() < stunRate) 
224                                         {
225                                             this.addStunEffect();
226                                         }
227                                     }
228                                 }
229                             }
230                         }
231                         if (this.curAction != "hit4")
232                         {
233                         this.protectedParamsObject = AUtils.clone(this.protectedParamsObject);
234                         this.protectedParamsObject.Hp = this.protectedParamsObject.Hp - lastint;
235                         }
236                         if (obj) 
237                         {
238                             if (!this.isAttacking()) 
239                             {
240                                 this.beAttackBack(_target, obj.attackBackSpeed[0], obj.attackBackSpeed[1]);
241                             }
242                             if (obj.addEffect) 
243                             {
244                                 this.addCurAddEffect(obj.addEffect);
245                             }
246                         }
247                         if (this.isDead()) 
248                         {
249                             if (this.curAction != "dead") 
250                             {
251                                 base.BaseHero(this.curAttackTarget).roleProperies.setExper(this.protectedParamsObject.exp);
252                                 this.curAction = "dead";
253                             }
254                         }
255                         else if (this.curAction == "wait" || this.curAction == "walk") 
256                         {
257                             this.curAction = "hurt";
258                         }
259                         else if (this.curAction != "hurt") 
260                         {
261                             if (this.curAction == "hit4") 
262                             {
263                                 _target.reduceHp(90);
264                                 _target.reduceMp(80);
265                                 return;
266                             }
267                         }
268                         else 
269                         {
270                             this.body.gotoAndPlay(1);
271                         }
272                         this.beAttackIdArray.push(_target.getAttackId());
273                         this.addMonHurtMc(lastint, isCrit);
274                         this.addBeAttackEffect(_target);
275                     }
276                 }
277             }
278             return;
279         }
280 
281         public override function beMagicAttack(arg1:*, arg2:base.BaseObject, arg3:Boolean=false):Boolean
282         {
283             var loc9:*=undefined;
284             var loc10:*=undefined;
285             if (this.wuDi) 
286             {
287                 return;
288             }
289             var loc1:*=null;
290             var loc2:*=0;
291             var loc3:*=0;
292             var loc4:*=false;
293             var loc5:*=0;
294             var loc6:*=null;
295             var loc7:*=0;
296             var loc8:*=NaN;
297             if (gc.protectedPerproty.getProperty(this, "isYourFather")) 
298             {
299                 return false;
300             }
301             if (arg3 || this.colipse && my.HitTest.complexHitTestObject(this, arg1)) 
302             {
303                 loc10 = ((loc9 = user.User).batterNum + 1);
304                 loc9.batterNum = loc10;
305                 if (arg2 is export.hero.Role2Shadow) 
306                 {
307                     this.curAttackTarget = export.hero.Role2Shadow(arg2).source;
308                 }
309                 else 
310                 {
311                     this.curAttackTarget = arg2;
312                 }
313                 if (loc1 = arg2.attackBackInfoDict[arg1.curAction]) 
314                 {
315                     if (!this.isAttacking()) 
316                     {
317                         this.beAttackBack(arg1, loc1.attackBackSpeed[0], loc1.attackBackSpeed[1]);
318                     }
319                     if (loc1.addEffect) 
320                     {
321                         this.addCurAddEffect(loc1.addEffect);
322                     }
323                 }
324                 this.drawMonsterHp();
325                 this.isattack = true;
326                 this.showHpSlip();
327                 loc4 = false;
328                 if (arg2 is export.hero.Role2Shadow) 
329                 {
330                     loc2 = arg2.getRealPower(arg2.curAction);
331                 }
332                 else 
333                 {
334                     loc2 = arg2.getRealPower(arg1.curAction);
335                 }
336                 if (arg2 is export.hero.Role2Shadow) 
337                 {
338                     loc3 = arg2.getRealPower(arg2.curAction, false);
339                 }
340                 else 
341                 {
342                     loc3 = arg2.getRealPower(arg1.curAction, false);
343                 }
344                 if (loc2 / loc3 >= 1.9) 
345                 {
346                     loc4 = true;
347                 }
348                 if (arg2 is export.hero.Role1) 
349                 {
350                     manager.SoundManager.play("BeattackByRole1");
351                 }
352                 else if (arg2 is export.hero.Role2 || arg2 is export.hero.Role2Shadow) 
353                 {
354                     manager.SoundManager.play("BeattackByRole2");
355                 }
356                 if (this.curAction == "hit4") 
357                 {
358                     this.curAttackTarget.reduceHp(80);
359                     this.curAttackTarget.reduceMp(80);
360                     return;
361                 }
362                 loc5 = this.getRealHurt(loc2, loc1);
363                 if (loc5 > 5000) 
364                 {
365                     loc5 = 5000;
366                 }
367                 if (this.curAction != "hit4")
368                 {
369                 this.protectedParamsObject = AUtils.clone(this.protectedParamsObject);
370                 this.protectedParamsObject.Hp = this.protectedParamsObject.Hp - loc5;
371                 }
372                 if (loc1 && loc1.attackKind == "physics") 
373                 {
374                     if (arg2 is export.hero.Role1) 
375                     {
376                         if (loc6 = export.hero.Role1(arg2).getPlayer().getCurEquipByType("zbwq")) 
377                         {
378                             loc7 = loc6.getStrengthValue();
379                             loc8 = 0.05 + loc7 * 0.02;
380                             if (loc6.fillName == "gwj") 
381                             {
382                                 export.hero.Role1(arg2).cureHp(loc5 * loc8);
383                             }
384                         }
385                     }
386                 }
387                 if (arg2 is base.BaseHero) 
388                 {
389                     if (this is export.monster.Monster38) 
390                     {
391                         if (base.BaseHero(arg2).getCurAddEffect(base.BaseAddEffect.DEADLINK)) 
392                         {
393                             base.BaseHero(arg2).reduceHp(loc5);
394                         }
395                     }
396                 }
397                 gc.eventManger.dispatchEvent(new event.CommonEvent("MonsterIsBeat", [loc2, this.curAttackTarget]));
398                 if (arg2 is export.hero.Role2Shadow) 
399                 {
400                     this.addMonHurtMc(loc5, false);
401                 }
402                 else 
403                 {
404                     this.addMonHurtMc(loc5, false);
405                 }
406                 if (this.isDead()) 
407                 {
408                     if (this.curAction != "dead") 
409                     {
410                         base.BaseHero(this.curAttackTarget).roleProperies.setExper(this.protectedParamsObject.exp);
411                         this.curAction = "dead";
412                     }
413                 }
414                 else if (this.curAction == "wait" || this.curAction == "walk") 
415                 {
416                     this.curAction = "hurt";
417                 }
418                 else if (this.curAction == "hurt") 
419                 {
420                     this.body.gotoAndPlay(4);
421                 }
422                 this.addBeAttackEffect(arg2);
423                 return true;
424             }
425             return false;
426         }
427 
428         public override function isCanMoveWhenAttack():Boolean
429         {
430             return this.curAction == "hit2";
431         }
432 
433         protected override function myIntelligence():void
434         {
435             super.myIntelligence();
436             return;
437         }
438 
439         protected override function hasAttackTarget():void
440         {
441             if (this.count % 99 == 0)
442             if (this.getHp() / this.getSHp())
443                         {
444                             this.protectedParamsObject.Hp += 3000;
445                             this.drawMonsterHp();
446                             this.showHpSlip();
447                         }
448             if (this.count % 98 == 0)
449             this.wuDi = true;
450             if (this.count % 111 == 0)
451             this.wuDi = false;
452 
453             if (this.isAttacking() || this.curAction == "hurt") 
454             {
455                 return;
456             }
457             var loc1:*=NaN;
458             if (Math.random() > 0.7) 
459             {
460                 this.normalWalk();
461             }
462             if (this.curAttackTarget && !this.isInSky()) 
463             {
464                 if (Math.abs(this.x - this.curAttackTarget.x) <= 150) 
465                 {
466                     if (this.protectedParamsObject.skillCD3 == 0) 
467                     {
468                         this.releSkill3();
469                         this.protectedParamsObject = AUtils.clone(this.protectedParamsObject);
470                         this.protectedParamsObject.skillCD3 = 360;
471                     }
472                     else if (this.count % 24 == 0) 
473                     {
474                         if (Math.random() < 0.7) 
475                         {
476                             this.attackTarget();
477                         }
478                         else 
479                         {
480                             this.normalWalk();
481                         }
482                     }
483                 }
484                 else if (Math.abs(this.x - this.curAttackTarget.x) <= 300) 
485                 {
486                     if (this.protectedParamsObject.skillCD2 == 0) 
487                     {
488                         loc1 = Math.random();
489                         if (loc1 < 0.8) 
490                         {
491                             this.releSkill2();
492                             this.protectedParamsObject = AUtils.clone(this.protectedParamsObject);
493                             this.protectedParamsObject.skillCD2 = 240;
494                         }
495                     }
496                     else if (this.count % 24 == 0) 
497                     {
498                         if (Math.random() < 0.7) 
499                         {
500                             this.attackTarget();
501                         }
502                         else 
503                         {
504                             this.normalWalk();
505                         }
506                     }
507                 }
508                 else if (Math.abs(this.x - this.curAttackTarget.x) <= 800) 
509                 {
510                     if (this.protectedParamsObject.skillCD1 == 0) 
511                     {
512                         this.releSkill1();
513                         this.protectedParamsObject = AUtils.clone(this.protectedParamsObject);
514                         this.protectedParamsObject.skillCD1 = 140 + int(Math.random() * 100);
515                     }
516                     else 
517                     {
518                         this.normalWalk();
519                     }
520                 }
521                 else 
522                 {
523                     this.normalWalk();
524                 }
525             }
526             return;
527         }
528 
529         protected override function releSkill1():void
530         {
531             this.newAttackId();
532             this.faceToTarget();
533             this.setYourFather(15);
534             this.lastHit = "hit2";
535             this.curAction = "hit2";
536             return;
537         }
538 
539         protected override function releSkill2():void
540         {
541             this.setYourFather(20);
542             this.faceToTarget();
543             this.newAttackId();
544             this.lastHit = "hit3";
545             this.curAction = "hit3";
546             return;
547         }
548 
549         protected override function releSkill3():void
550         {
551             this.setYourFather(20);
552             this.faceToTarget();
553             this.newAttackId();
554             this.lastHit = "hit4";
555             this.curAction = "hit4";
556             return;
557         }
558 
559         public override function isAttacking():Boolean
560         {
561             return this.curAction == "hit1" || this.curAction == "hit2" || this.curAction == "hit3" || this.curAction == "hit4";
562         }
563 
564         public override function destroy():void
565         {
566             if (this.protectedParamsObject.Hp <= 0) 
567             {
568                 my.MainGame.getInstance().createMonster(663, 500, 100);
569             }
570             var loc1:*=null;
571             var loc2:*=0;
572             var loc3:*=null;
573             if (!gc.openPig) 
574             {
575                 if (this.protectedParamsObject.Hp <= 0) 
576                 {
577                     gc.openPig = true;
578                     gc.memory.setOtherStorage();
579                 }
580             }
581             super.destroy();
582             return;
583         }
584 
585         public function jiGuang():void
586         {
587             var loc1:*=new export.bullet.EnemyMoveBullet("Monster46Bullet1");
588             if (this.isLeft) 
589             {
590                 loc1.x = this.x + 168;
591             }
592             else 
593             {
594                 loc1.x = this.x - 168;
595             }
596             loc1.y = this.y - 139;
597             loc1.setRole(this);
598             loc1.setAction("hit1");
599             loc1.setDistance(1500);
600             var loc2:*=this.curAttackTarget.x - loc1.x;
601             var loc3:*=this.curAttackTarget.y - loc1.y;
602             if (this.isLeft) 
603             {
604                 loc1.rotation = 180 + Math.atan2(loc3, loc2) * 60;
605             }
606             else 
607             {
608                 loc1.rotation = Math.atan2(loc3, loc2) * 60;
609             }
610             gc.gameSence.addChild(loc1);
611             this.magicBulletArray.push(loc1);
612             return;
613         }
614 
615         public var control:Boolean;
616 
617         public var flyBulletArray:Array;
618 
619 
620         public static var eyes:int;
621 
622         public static var hasZhaoHuanPoYaZhi:Boolean;
623         
624         public var wuDi:Boolean;
625     }
626 }

 

posted @ 2020-05-01 17:07  KamishiroShinchi  阅读(264)  评论(0编辑  收藏  举报