Implement a few more properties
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
		
							parent
							
								
									6e2238664b
								
							
						
					
					
						commit
						667be871bb
					
				| @ -1218,6 +1218,13 @@ float operator ""_F(const char*key,std::size_t len){ | |||||||
| 	return DATA.GetProperty(std::string(key,len)).GetReal(); | 	return DATA.GetProperty(std::string(key,len)).GetReal(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | float operator ""_FRange(const char*key,std::size_t len){ | ||||||
|  | 	if(utils::datafile::DEBUG_ACCESS_OPTIONS){ | ||||||
|  | 		std::cout<<"Reading "<<std::string(key,len)<<std::endl; | ||||||
|  | 	} | ||||||
|  | 	return util::random(DATA.GetProperty(std::string(key,len)).GetReal(1)-DATA.GetProperty(std::string(key,len)).GetReal(0))+DATA.GetProperty(std::string(key,len)).GetReal(0); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| double operator ""_D(const char*key,std::size_t len){ | double operator ""_D(const char*key,std::size_t len){ | ||||||
| 	if(utils::datafile::DEBUG_ACCESS_OPTIONS){ | 	if(utils::datafile::DEBUG_ACCESS_OPTIONS){ | ||||||
| 		std::cout<<std::string(key,len)<<std::endl; | 		std::cout<<std::string(key,len)<<std::endl; | ||||||
|  | |||||||
| @ -13,23 +13,23 @@ EnergyBolt::EnergyBolt(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel | |||||||
| void EnergyBolt::Update(float fElapsedTime){ | void EnergyBolt::Update(float fElapsedTime){ | ||||||
| 	lastParticleSpawn=std::max(0.f,lastParticleSpawn-fElapsedTime); | 	lastParticleSpawn=std::max(0.f,lastParticleSpawn-fElapsedTime); | ||||||
| 	if(lastParticleSpawn==0){ | 	if(lastParticleSpawn==0){ | ||||||
| 		lastParticleSpawn=0.03; | 		lastParticleSpawn="Wizard.Auto Attack.ParticleFrequency"_F; | ||||||
| 		game->AddEffect(std::make_unique<Effect>(pos,util::random(1),AnimationState::ENERGY_PARTICLE,upperLevel,util::random(2),0.5f,vf2d{util::random(60)-30,util::random(60)-30})); | 		game->AddEffect(std::make_unique<Effect>(pos,"Wizard.Auto Attack.ParticleLifetimeRange"_FRange,AnimationState::ENERGY_PARTICLE,upperLevel,"Wizard.Auto Attack.ParticleSizeRange"_FRange,"Wizard.Auto Attack.ParticleFadeoutTime"_F,vf2d{"Wizard.Auto Attack.ParicleSpeedRange"_FRange,"Wizard.Auto Attack.ParicleSpeedRange"_FRange})); | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool EnergyBolt::PlayerHit(Player*player) | bool EnergyBolt::PlayerHit(Player*player) | ||||||
| { | { | ||||||
| 	deactivated=true; | 	deactivated=true; | ||||||
| 	fadeOutTime=0.2f; | 	fadeOutTime="Wizard.Auto Attack.BulletHitFadeoutTime"_F; | ||||||
| 	game->AddEffect(std::make_unique<Effect>(player->GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,player->GetSizeMult(),0.25)); | 	game->AddEffect(std::make_unique<Effect>(player->GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,player->GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F)); | ||||||
| 	return false; | 	return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool EnergyBolt::MonsterHit(Monster& monster) | bool EnergyBolt::MonsterHit(Monster& monster) | ||||||
| { | { | ||||||
| 	deactivated=true; | 	deactivated=true; | ||||||
| 	fadeOutTime=0.2f; | 	fadeOutTime="Wizard.Auto Attack.BulletHitFadeoutTime"_F; | ||||||
| 	game->AddEffect(std::make_unique<Effect>(monster.GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,monster.GetSizeMult(),0.25)); | 	game->AddEffect(std::make_unique<Effect>(monster.GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,monster.GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F)); | ||||||
| 	return false; | 	return false; | ||||||
| } | } | ||||||
|  | |||||||
| @ -84,7 +84,7 @@ void Warrior::InitializeClassAbilities(){ | |||||||
|                 p->AddBuff(BuffType::ATTACK_UP,"Warrior.Ability 1.AttackUpDuration"_F,"Warrior.Ability 1.AttackIncrease"_F); |                 p->AddBuff(BuffType::ATTACK_UP,"Warrior.Ability 1.AttackUpDuration"_F,"Warrior.Ability 1.AttackIncrease"_F); | ||||||
|                 p->AddBuff(BuffType::DAMAGE_REDUCTION,"Warrior.Ability 1.DamageReductionDuration"_F,"Warrior.Ability 1.DamageReduction"_F); |                 p->AddBuff(BuffType::DAMAGE_REDUCTION,"Warrior.Ability 1.DamageReductionDuration"_F,"Warrior.Ability 1.DamageReduction"_F); | ||||||
|                 for(Monster&m:MONSTER_LIST){ |                 for(Monster&m:MONSTER_LIST){ | ||||||
|                     if(m.GetSizeMult()>="Warrior.Ability 1.AffectedSizeMin"_F&&m.GetSizeMult()<="Warrior.Ability 1.AffectedSizeMax"_F&&geom2d::overlaps(geom2d::circle<float>(p->GetPos(),12*"Warrior.Ability 1.Range"_I/100.f),geom2d::circle<float>(m.GetPos(),m.GetSizeMult()*12))){ |                     if(m.GetSizeMult()>="Warrior.Ability 1.AffectedSizeRange"_f[0]&&m.GetSizeMult()<="Warrior.Ability 1.AffectedSizeRange"_f[1]&&geom2d::overlaps(geom2d::circle<float>(p->GetPos(),12*"Warrior.Ability 1.Range"_I/100.f),geom2d::circle<float>(m.GetPos(),m.GetSizeMult()*12))){ | ||||||
|                         m.AddBuff(BuffType::SLOWDOWN,"Warrior.Ability 1.SlowdownDuration"_F,"Warrior.Ability 1.SlowdownAmt"_F); |                         m.AddBuff(BuffType::SLOWDOWN,"Warrior.Ability 1.SlowdownDuration"_F,"Warrior.Ability 1.SlowdownAmt"_F); | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|  | |||||||
| @ -67,7 +67,7 @@ void Wizard::OnUpdate(float fElapsedTime){ | |||||||
| bool Wizard::AutoAttack(){ | bool Wizard::AutoAttack(){ | ||||||
| 	attack_cooldown_timer=MAGIC_ATTACK_COOLDOWN; | 	attack_cooldown_timer=MAGIC_ATTACK_COOLDOWN; | ||||||
| 	float angleToCursor=atan2(game->GetWorldMousePos().y-GetPos().y,game->GetWorldMousePos().x-GetPos().x); | 	float angleToCursor=atan2(game->GetWorldMousePos().y-GetPos().y,game->GetWorldMousePos().x-GetPos().x); | ||||||
| 	BULLET_LIST.push_back(std::make_unique<EnergyBolt>(EnergyBolt(GetPos(),{cos(angleToCursor)*"Wizard.Auto Attack.Speed"_F,sin(angleToCursor)*"Wizard.Auto Attack.Speed"_F},"Wizard.Auto Attack.Radius"_F/100*12,GetAttack(),upperLevel,true,WHITE))); | 	BULLET_LIST.push_back(std::make_unique<EnergyBolt>(EnergyBolt(GetPos(),{cos(angleToCursor)*"Wizard.Auto Attack.Speed"_F,sin(angleToCursor)*"Wizard.Auto Attack.Speed"_F},"Wizard.Auto Attack.Radius"_F/100*12,GetAttack()*"Wizard.Auto Attack.DamageMult"_F,upperLevel,true,WHITE))); | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| void Wizard::InitializeClassAbilities(){ | void Wizard::InitializeClassAbilities(){ | ||||||
| @ -104,7 +104,7 @@ void Wizard::InitializeClassAbilities(){ | |||||||
|         Wizard::ability1.action= |         Wizard::ability1.action= | ||||||
|             [](Player*p,vf2d pos={}){ |             [](Player*p,vf2d pos={}){ | ||||||
|                 float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); |                 float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); | ||||||
|                 BULLET_LIST.push_back(std::make_unique<FireBolt>(FireBolt(p->GetPos(),{cos(angleToCursor)*275,sin(angleToCursor)*275},12,p->GetAttack(),p->upperLevel,true,{240,120,60}))); |                 BULLET_LIST.push_back(std::make_unique<FireBolt>(FireBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F},"Wizard.Ability 1.Radius"_F/100*12,p->GetAttack()*"Wizard.Ability 1.InitialDamageMult"_F,p->upperLevel,true,"Wizard.Ability 1.BulletColor"_Pixel))); | ||||||
|                 return true; |                 return true; | ||||||
|             }; |             }; | ||||||
|     #pragma endregion |     #pragma endregion | ||||||
| @ -112,7 +112,7 @@ void Wizard::InitializeClassAbilities(){ | |||||||
|         Wizard::ability2.action= |         Wizard::ability2.action= | ||||||
|             [](Player*p,vf2d pos={}){ |             [](Player*p,vf2d pos={}){ | ||||||
|                 float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); |                 float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); | ||||||
|                 BULLET_LIST.push_back(std::make_unique<LightningBolt>(LightningBolt(p->GetPos(),{cos(angleToCursor)*230,sin(angleToCursor)*230},12,p->GetAttack()*4,p->upperLevel,true,WHITE))); |                 BULLET_LIST.push_back(std::make_unique<LightningBolt>(LightningBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F},"Wizard.Ability 2.Radius"_F/100*12,p->GetAttack()*"Wizard.Ability 2.DamageMult"_F,p->upperLevel,true,"Wizard.Ability 2.BulletColor"_Pixel))); | ||||||
|                 return true; |                 return true; | ||||||
|             }; |             }; | ||||||
|     #pragma endregion |     #pragma endregion | ||||||
|  | |||||||
| @ -59,8 +59,7 @@ Warrior | |||||||
|         DamageReduction = 0.1 |         DamageReduction = 0.1 | ||||||
| 
 | 
 | ||||||
|         # The smallest and largest size of enemies this ability affects (inclusive). |         # The smallest and largest size of enemies this ability affects (inclusive). | ||||||
|         AffectedSizeMin = 0 |         AffectedSizeRange = 0,1 | ||||||
|         AffectedSizeMax = 1 |  | ||||||
| 
 | 
 | ||||||
|         # How long the applied slow debuff lasts in seconds. |         # How long the applied slow debuff lasts in seconds. | ||||||
|         SlowdownDuration = 5 |         SlowdownDuration = 5 | ||||||
|  | |||||||
| @ -8,6 +8,19 @@ Wizard | |||||||
|         Radius = 100 |         Radius = 100 | ||||||
|         Speed = 200 |         Speed = 200 | ||||||
|         Cooldown = 0.85 |         Cooldown = 0.85 | ||||||
|  | 
 | ||||||
|  |         # When bullet makes contact, how fast the bullet will fade out. | ||||||
|  |         BulletHitFadeoutTime = 0.2 | ||||||
|  | 
 | ||||||
|  |         # How much time passes before another particle spawns from the bullet. | ||||||
|  |         ParticleFrequency = 0.03 | ||||||
|  |         # Specify a minimum and maximum range | ||||||
|  |         ParticleLifetimeRange = 0,1 | ||||||
|  |         ParticleSizeRange = 0,2 | ||||||
|  |         ParticleFadeoutTime = 0.5 | ||||||
|  |         ParticleSpeedRange = -30,30 | ||||||
|  |          | ||||||
|  |         SplashEffectFadeoutTime = 0.25 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     Right Click Ability |     Right Click Ability | ||||||
| @ -59,6 +72,15 @@ Wizard | |||||||
|         Precast Time = 0 |         Precast Time = 0 | ||||||
|         Casting Range = 0 |         Casting Range = 0 | ||||||
|         Casting Size = 0 |         Casting Size = 0 | ||||||
|  | 
 | ||||||
|  |         # Damage multiplier of the initial hit. | ||||||
|  |         InitialDamageMult = 1 | ||||||
|  | 
 | ||||||
|  |         BulletSpeed = 275 | ||||||
|  |         Radius = 100 | ||||||
|  | 
 | ||||||
|  |         #Coloring of the bullet. | ||||||
|  |         BulletColor = 240, 120, 60, 255 | ||||||
|     } |     } | ||||||
|     Ability 2 |     Ability 2 | ||||||
|     { |     { | ||||||
| @ -73,6 +95,15 @@ Wizard | |||||||
|         Precast Time = 0 |         Precast Time = 0 | ||||||
|         Casting Range = 0 |         Casting Range = 0 | ||||||
|         Casting Size = 0 |         Casting Size = 0 | ||||||
|  | 
 | ||||||
|  |         # Damage multiplier of the initial hit. | ||||||
|  |         DamageMult = 4 | ||||||
|  | 
 | ||||||
|  |         BulletSpeed = 230 | ||||||
|  |         Radius = 100 | ||||||
|  |          | ||||||
|  |         #Coloring of the bullet. | ||||||
|  |         BulletColor = 255, 255, 255, 255 | ||||||
|     } |     } | ||||||
|     Ability 3 |     Ability 3 | ||||||
|     { |     { | ||||||
|  | |||||||
| @ -20,4 +20,5 @@ float operator ""_F(const char*key,std::size_t len); | |||||||
| //Read a double key from the config.
 | //Read a double key from the config.
 | ||||||
| double operator ""_D(const char*key,std::size_t len); | double operator ""_D(const char*key,std::size_t len); | ||||||
| 
 | 
 | ||||||
| Pixel operator ""_Pixel(const char*key,std::size_t len); | Pixel operator ""_Pixel(const char*key,std::size_t len); | ||||||
|  | float operator ""_FRange(const char*key,std::size_t len); | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user