找回密码
 点一下
查看: 2583|回复: 5

Dota 技能 山岭巨人 - 投掷(傻瓜移植版)

[复制链接]
发表于 2011-12-20 22:00:14 | 显示全部楼层 |阅读模式
1 - 本演示需1.24b以上魔兽版本
2 - 为方便WEER移植已经写好注释
3 - 支持多人同时释放
4 - 需JassHelper插件支持(YDWE)
5 - 仅供学习与娱乐
ABC.gif


[通魔作坊]dota技能 - 投掷 .w3x (167 KB, 下载次数: 238)


[jass]
//! zinc
library ThrowingOfKu requires TimerUtils{

    private{
        constant string SPELL_UNIT_ID    = "thunderclap"  ;  //伤害技能命令串
        constant real SELECT_RANGE       = 275            ;  //抓取单位的范围  
        constant real UNIT_LIVE_TIME     = 1.00           ;  //马甲生命周期
        constant real HEIGHT_MAX         = 750.00         ;  //顶点高度
        constant integer COUNT_MAX       = 40             ;  //高度/距离变幻速度
        constant string TEXT             = "|cffffcc00没有可投掷的单位|r" ;

    // 上面的常量参数按个人需要自行修改
        constant integer SPELL_ID        = 'A000'         ;  //投掷技能ID
        constant integer SPELL_ID2       = 'A001'         ;  //雷霆一击技能ID
        constant integer UNITID_ID       = 'ewsp'         ;  //马甲ID
    // 上面的常量参数必须要修改
    }
  private struct Throwing{
        
        private{
            unit Hero,u,u2;
            timer t ;
            real h,ang,Dis;
            integer count,Level;
        }
        
        private static method SpellThroingTimer(){
            real ang,s,h;
            unit u;
            Throwing data = Throwing(GetTimerData(GetExpiredTimer()));
            ang = Atan2(GetUnitY(data.u)-GetUnitY(data.u2),GetUnitX(data.u)-GetUnitX(data.u2));
            s = data.Dis / I2R(COUNT_MAX);
            SetUnitX(data.u2,GetUnitX(data.u2)+s*Cos(ang));
            SetUnitY(data.u2,GetUnitY(data.u2)+s*Sin(ang));
            h = (((-4*HEIGHT_MAX)/(Pow(data.Dis,2.00)))*Pow(((I2R(data.count)*s)-(data.Dis/2.00)),2.00))+HEIGHT_MAX;
            SetUnitFlyHeight(data.u2,h,0);
            data.count -= 1 ;
            if (data.count < 0) {
                u = CreateUnit(GetOwningPlayer(data.Hero),UNITID_ID,GetUnitX(data.u2),GetUnitY(data.u2),0);
                SetUnitAbilityLevel(u,SPELL_ID2,data.Level);
                IssueImmediateOrder( u, SPELL_UNIT_ID );
                UnitApplyTimedLife( u, 'BHwe', UNIT_LIVE_TIME );
                SetUnitFlyHeight(data.u2,GetUnitDefaultFlyHeight(data.u2),0);
                ReleaseTimer(data.t);
                data.deallocate();
            }
        }
        
        private static method SpellThrowing(unit Hero,unit u){
            Throwing data = Throwing.allocate();
            real x1= GetUnitX(u),y1= GetUnitY(u),x2,y2;
            group g = CreateGroup(),g2 = CreateGroup();
            unit u2 = null,Majia;
            GroupEnumUnitsInRange(g,GetUnitX(Hero),GetUnitY(Hero),SELECT_RANGE,null);
            do{
                u2 = FirstOfGroup(g);
                if(GetUnitState(u2, UNIT_STATE_LIFE) > 0 && u2!=Hero&&GetUnitTypeId(u2)!=UNITID_ID ){
                    GroupAddUnit(g2,u2);
                }
                GroupRemoveUnit(g,u2);
            }while( u2 != null );
            if (IsUnitGroupEmptyBJ(g2) != true) {
                u2 = /*GroupPickRandomUnit*/FirstOfGroup(g2);
                UnitAddAbility(u2, 'Amrf' );
                UnitRemoveAbility(u2, 'Amrf' );
                x2 = GetUnitX(Hero);
                y2 = GetUnitY(Hero);
                data.Dis = SquareRoot((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
                data.count = COUNT_MAX;
                data.Hero = Hero;
                data.u = u ;
                data.u2 = u2;
                data.t = NewTimer();
                //! textmacro LevelIf takes number
                if  (GetUnitAbilityLevel(Hero, SPELL_ID) == $number$ ){
                    data.Level = $number$;
                }
                //! endtextmacro
                //! runtextmacro LevelIf("1")
                //! runtextmacro LevelIf("2")
                //! runtextmacro LevelIf("3")
                //! runtextmacro LevelIf("4")
                SetTimerData(data.t,integer(data));
                TimerStart(data.t,0.03,true,function Throwing.SpellThroingTimer);
            }
            else {
                IssueImmediateOrder(Hero, "stop" );
                DisplayTimedTextToPlayer( GetOwningPlayer(Hero), 0.50, 0.00, 2.00,TEXT);
            }
            DestroyGroup(g);
            DestroyGroup(g2);
            u2 = null;
            g = null;
        }
        
        private static method Start() -> boolean{
            if (GetSpellAbilityId() == SPELL_ID){
                Throwing.SpellThrowing(GetTriggerUnit(),GetSpellTargetUnit());
            }
            return false;
        }
   
        private static method onInit() {
            trigger t = CreateTrigger();
            TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT );
            TriggerAddCondition( t, Condition( function Throwing.Start ) );
            t = null;
        }
    }
}
//! endzinc
[/jass]

评分

参与人数 1威望 +23 收起 理由
okolek + 23 加分。

查看全部评分

发表于 2011-12-20 23:57:37 | 显示全部楼层
  J啊 J
回复

使用道具 举报

 楼主| 发表于 2011-12-28 08:00:01 | 显示全部楼层
[attachment=undefined]
回复

使用道具 举报

 楼主| 发表于 2011-12-28 08:01:03 | 显示全部楼层
未命名.jpg
回复

使用道具 举报

发表于 2012-1-29 22:56:09 | 显示全部楼层
像IMBA里多砸几下很邪恶
回复

使用道具 举报

发表于 2012-3-28 16:30:49 | 显示全部楼层
求教 拜师 你当我师傅 QQ1974772852
啥都不会正自己做图玩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-6-26 09:40 , Processed in 0.260991 second(s), 26 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表