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

中秋吃月饼

[复制链接]
发表于 2008-10-5 17:43:34 | 显示全部楼层 |阅读模式
(被自己忍无可忍的和谐掉了)

图: PIC2.jpg

代码:
[codes=jass]


globals
gamecache xlGC = null
unit cake_Temp = null
integer cake_num = 0
integer cake_uid = 0
endglobals

function GetGC takes nothing returns gamecache
if xlGC == null then
call FlushGameCache(InitGameCache("XLGC.w3v"))
set xlGC = InitGameCache("XLGC.w3v")
return xlGC
endif
return xlGC
endfunction

function H2I takes handle h returns integer
return h
return 0
endfunction

function SetTimerInteger takes timer ti ,string key, integer i returns nothing
call StoreInteger(GetGC(),I2S(H2I(ti)),key,i)
endfunction

function GetTimerInteger takes timer ti ,string key returns integer
return GetStoredInteger(GetGC(),I2S(H2I(ti)),key)
endfunction

function SetTimerReal takes timer ti ,string key, real r returns nothing
call StoreReal(GetGC(),I2S(H2I(ti)),key,r)
endfunction

function GetTimerReal takes timer ti ,string key returns real
return GetStoredReal(GetGC(),I2S(H2I(ti)),key)
endfunction

function SetTimerHandle takes timer ti ,handle h ,integer number returns nothing
call StoreInteger(GetGC(),I2S(H2I(ti)),I2S(number),H2I(h))
endfunction

function GetTimerUnit takes timer ti ,integer number returns unit
return GetStoredInteger(GetGC(),I2S(H2I(ti)),I2S(number))
return null
endfunction

function GetTimerGroup takes timer ti ,integer number returns group
return GetStoredInteger(GetGC(),I2S(H2I(ti)),I2S(number))
return null
endfunction

function AddTimerNumber takes timer ti returns integer
local integer num = GetStoredInteger( GetGC(), I2S(H2I(ti)), "Num" )
set num = num + 1
call StoreInteger( GetGC(), I2S(H2I(ti)), "Num", num )
return num
endfunction

function Cake_TimeVal takes integer unit_id returns real
return 2.0                     //每多少秒回复一次生命/魔法
endfunction

function Cake_TimeNumber takes integer unit_id returns integer
return 10                      //共恢复多少次生命/魔法
endfunction

function Cake_Radius takes integer unit_id returns real
return 700.0                   //恢复范围
endfunction

function Cake_ResumeAdd_UnitNumber takes integer u_num, integer unit_id returns real
return 10.0 + u_num * 2        //恢复数值是范围内单位的个数和技能等级的基础数值
endfunction

function Cake_ResumeGene_UnitNumber takes integer u_num, integer unit_id returns real
return I2R(u_num)/20.0         //恢复数值是范围内单位的个数的几倍
endfunction

function Cake_ResumeGene_Life takes unit u, integer u_num, integer unit_id returns real
if IsUnitType( u, UNIT_TYPE_HERO ) == true then
  return 1.1 + GetHeroStr( u, true )*0.03
endif
return 1.1                     //生命的恢复数值是基础数的几倍
endfunction

function Cake_ResumeGene_Mana takes unit u, integer u_num, integer unit_id returns real
if IsUnitType( u, UNIT_TYPE_HERO ) == true then
  return 0.8 + GetHeroInt( u, true )*0.02
endif
return 0.8                     //魔法的恢复数值是基础数的几倍
endfunction

function Cake_Remove_TimerNumber takes integer timer_num, integer unit_id returns real
return 5.0                     //月饼减少数值是时间的几倍
endfunction

function Cake_Remove_UnitNumber takes integer u_num, integer unit_id returns real
return I2R(u_num) * 2.0             //月饼减少数值是范围内单位的个数和技能等级的基础数值
endfunction

function Cake_RemoveGene_UnitNumber takes integer u_num, integer unit_id returns real
return 1.0                     //月饼减少数值是范围内单位的个数的几倍
endfunction

function Cake_Scale takes unit cake returns real
return 0.50 + (GetUnitLifePercent(cake) / 200.0)   //月饼的尺寸
endfunction

function Cake_Red takes unit cake returns integer
return 125                                       //月饼的红
endfunction

function Cake_Green takes unit cake returns integer
return 155 + (100 - R2I(GetUnitLifePercent(cake)))//月饼的绿
endfunction

function Cake_Blue takes unit cake returns integer
return 155                                        //月饼的蓝
endfunction

function Cake_OtherUnitId takes integer unit_id returns integer
return 'uplg'                  //月饼腐烂后,瘟疫单位的ID
endfunction

function Cake_OtherUnitTime takes integer unit_id returns real
return 30.0                    //月饼腐烂后,瘟疫单位的ID
endfunction

function Cake_Ability takes integer unit_id returns integer
return 'A001'
endfunction

function Cake_AbilityLevel takes integer u_num returns integer
return IMaxBJ(0,u_num-5)
endfunction

function Cake_ResumeGroup takes nothing returns nothing
local unit u = GetEnumUnit()
local real HP = GetUnitState( u, UNIT_STATE_LIFE )
local real MP = GetUnitState( u, UNIT_STATE_MANA )
local real resume_val = 0.0
local integer u_num = cake_num
local integer uid = cake_uid
set resume_val = Cake_ResumeAdd_UnitNumber( u_num, uid )
set resume_val = resume_val * Cake_ResumeGene_UnitNumber( u_num, uid )
set HP = HP + (resume_val * Cake_ResumeGene_Life(u,u_num,uid) )
set MP = MP + (resume_val * Cake_ResumeGene_Mana(u,u_num,uid) )
call SetUnitState( u, UNIT_STATE_LIFE, HP )
call SetUnitState( u, UNIT_STATE_MANA, MP )
set u = null
endfunction

function Cake_Color_and_Scale takes unit cake returns nothing
local real scale = Cake_Scale(cake)
local integer red = Cake_Red(cake)
local integer blue = Cake_Blue(cake)
local integer green = Cake_Green(cake)
call SetUnitScale(cake, scale, scale, scale )
call SetUnitVertexColor(cake, red, green, blue, 255)
endfunction

function Cake_Resume takes unit cake, group g, integer time_num returns nothing
local real HP = GetUnitState( cake, UNIT_STATE_LIFE )
local real remove_val = 0.0
set cake_Temp = cake
set cake_num = CountUnitsInGroup( g )
set cake_uid = GetUnitTypeId( cake )
call SetUnitAbilityLevel(cake,Cake_Ability(cake_uid),Cake_AbilityLevel(cake_num))
call ForGroup(g, function Cake_ResumeGroup )
set remove_val = Cake_Remove_TimerNumber( cake_uid, time_num )
set remove_val = remove_val + Cake_Remove_UnitNumber( cake_num, cake_uid )
set remove_val = remove_val * Cake_RemoveGene_UnitNumber( cake_num, cake_uid )
call SetUnitState( cake, UNIT_STATE_LIFE, HP - remove_val )
call Cake_Color_and_Scale(cake)
set cake_uid = 0
set cake_Temp = null
set cake_num = 0
endfunction

function Cake_Condition takes nothing returns boolean
local integer id = GetUnitTypeId(cake_Temp)
local integer uid = GetUnitTypeId(GetFilterUnit())
if uid == id then
return false
endif
if uid == Cake_OtherUnitId(id) then
return false
endif
if (GetUnitLifePercent(GetFilterUnit()) >= 100.0 and GetUnitManaPercent(GetFilterUnit()) >= 100.0 ) then
return false
endif
return IsUnitAlly(GetFilterUnit(),GetOwningPlayer(cake_Temp))
endfunction

function Cake_Timer takes nothing returns nothing
local timer ti = GetExpiredTimer()
local unit cake = GetTimerUnit( ti, 0 )
local integer id = GetTimerInteger( ti, "Unit_Id" )
local integer max_num = GetTimerInteger( ti, "Timer_Number" )
local integer num = AddTimerNumber( ti )
local group g = GetTimerGroup( ti, 1 )
local real radius = GetTimerReal( ti, "Radius" )
local boolexpr e = null
local unit OtherUnit = null
local boolean b = false
if GetUnitState( cake,UNIT_STATE_LIFE ) == 295.0 then
call BJDebugMsg("AA")
endif
if num > max_num then
set b = true
set OtherUnit = CreateUnit( GetOwningPlayer( cake ), Cake_OtherUnitId(id), GetUnitX(cake), GetUnitY(cake), 0.0 )
call UnitApplyTimedLife( OtherUnit, 'BHwe', Cake_OtherUnitTime(id) )
call KillUnit( cake )
call SetUnitPathing(OtherUnit,false)
call SetUnitX(OtherUnit,GetUnitX(cake))
call SetUnitY(OtherUnit,GetUnitY(cake))
elseif GetUnitState(cake,UNIT_STATE_LIFE) <= 0.0 then
set b = true
else
set cake_Temp = cake
set e = Condition( function Cake_Condition )
call GroupEnumUnitsInRange( g, GetUnitX(cake), GetUnitY(cake), radius, e )
call Cake_Resume( cake, g, num )
call GroupClear( g )
call DestroyBoolExpr( e )
set e = null
set cake_Temp = null
endif
if b then
  call DestroyGroup( g )
  set g = null
  set e = null
  set cake = null
  call FlushStoredMission( GetGC(), I2S(H2I(ti)) )
  call DestroyTimer( ti )
  set ti = null
  set cake = null
  set g = null
  set e = null
  set OtherUnit = null
endif
set ti = null
set cake = null
set g = null
set e = null
set OtherUnit = null
endfunction

function Cake_Spell takes unit cake returns nothing
local location loc = GetUnitLoc( cake )
local integer id = GetUnitTypeId( cake )
local timer ti = CreateTimer()
local real radius = Cake_Radius( id )
local group g = null
call UnitAddAbility( cake, Cake_Ability(id) )
call UnitMakeAbilityPermanent( cake, true, Cake_Ability(id) )
set cake_Temp = cake
set g = GetUnitsInRangeOfLocMatching( radius, loc, Condition( function Cake_Condition ) )
if CountUnitsInGroup(g) == 0 then
call DestroyGroup( g )
set g = null
set g = CreateGroup()
endif
call SetTimerHandle(ti,cake,0)
call SetTimerInteger(ti,"Unit_Id",id)
call SetTimerInteger(ti,"Timer_Number",Cake_TimeNumber(id))
call SetTimerReal(ti,"Radius",radius)
call SetTimerHandle(ti,g,1)
call Cake_Resume(cake, g, 0 )
call GroupClear( g )
call TimerStart( ti, Cake_TimeVal( id ), true, function Cake_Timer )
call RemoveLocation( loc )
set loc = null
set ti = null
set g = null
set cake_Temp = null
endfunction

//此技能运算过程:
//一.周围单位恢复的数值:
//    1.首先是  10 + ( 周围单位的个数 * 2 )       <<----  由 Cake_ResumeAdd_UnitNumber 得到
//    2.然后再将这个数值 乘以  周围单位的个数     <<----  由 Cake_ResumeGene_UnitNumber 得到
//    3.  1.将这个数值 乘以 生命系数              <<----  由 Cake_ResumeGene_Life 得到
//          恢复周围单位的生命数值
//        2.将这个数值 乘以 魔法系数              <<----  由 Cake_ResumeGene_Mana 得到
//          恢复周围单位的魔法数值
//二.月饼减少生命的数值:
//         ↓↓↓↓ 计时器的设置时间 是               <<----  由 Cake_TimeVal 得到
//    1.每次计时器到期时 ,         减少 5 点生命 <<----  由 Cake_Remove_TimerNumber 得到
//    2.首先是  ( 周围单位的个数 * 2 ) 点生命     <<----  由 Cake_Remove_UnitNumber 得到
//    3.再将这个数 乘以 1.0                       <<----  由 Cake_RemoveGene_UnitNumber 得到
//    4.减少月饼的生命数值
//    5.改变月饼的尺寸为:





[/codes]

这个技能就是:
1.召唤一个月饼
2.月饼周围人越多,人群补血魔越高效,但月饼也会减血减得更快
3.月饼在60秒内没有吃完,就会腐烂,持续120秒向周围单位附加一个效果(每1秒减1点血,持续120秒)
4.月饼有光环。

恩………………
大家看看吧。

中秋吃月饼.w3x

33 KB, 下载次数: 37

评分

参与人数 2威望 +17 收起 理由
laomang11 + 16 晚来要罚你吃10个,哈哈
ΤΑΤ + 1 同情

查看全部评分

发表于 2008-10-5 18:23:56 | 显示全部楼层
为什么这么长的....
回复

使用道具 举报

发表于 2008-10-5 18:48:29 | 显示全部楼层
JASS我看了就眼花...
回复

使用道具 举报

发表于 2008-10-5 18:53:49 | 显示全部楼层
晕晕的
回复

使用道具 举报

发表于 2008-10-6 00:20:20 | 显示全部楼层
很好。。。这是一个好的想法
回复

使用道具 举报

发表于 2008-10-6 13:13:27 | 显示全部楼层
这个月饼不好看
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-24 11:05 , Processed in 0.114426 second(s), 22 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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