diff --git a/code/__DEFINES/role_preferences.dm b/code/__DEFINES/role_preferences.dm index 07bb830ece9a..1136640d29b6 100644 --- a/code/__DEFINES/role_preferences.dm +++ b/code/__DEFINES/role_preferences.dm @@ -51,6 +51,7 @@ #define ROLE_VAMPIRICACCIDENT "Vampiric Accident" #define ROLE_BLOODSUCKERBREAKOUT "Bloodsucker Breakout" #define ROLE_MONSTERHUNTER "Monster Hunter" +#define ROLE_SPACE_DRAGON "Space Dragon" #define ROLE_GOLEM "Golem" #define ROLE_SINFULDEMON "Demon of Sin" @@ -93,6 +94,7 @@ GLOBAL_LIST_INIT(special_roles, list( ROLE_FUGITIVE, ROLE_BLOODSUCKER = /datum/game_mode/bloodsucker, ROLE_MONSTERHUNTER, + ROLE_SPACE_DRAGON, ROLE_SINFULDEMON )) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm index a787074ca67a..9c3d422dc6a8 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm @@ -498,6 +498,52 @@ log_game("DYNAMIC: [key_name(S)] was spawned as a Nightmare by the midround ruleset.") return S + + +////////////////////////////////////////////// +// // +// SPACE DRAGON (GHOST) // +// // +////////////////////////////////////////////// + +/datum/dynamic_ruleset/midround/from_ghosts/space_dragon + name = "Space Dragon" + antag_datum = /datum/antagonist/space_dragon + antag_flag = "Space Dragon" + antag_flag_override = ROLE_SPACE_DRAGON + enemy_roles = list("Security Officer", "Detective", "Head of Security", "Captain") + required_enemies = list(2,2,1,1,1,1,1,0,0,0) + required_candidates = 1 + weight = 4 + cost = 10 + requirements = list(101,101,101,80,60,50,30,20,10,10) + repeatable = TRUE + var/list/spawn_locs = list() + +/datum/dynamic_ruleset/midround/from_ghosts/space_dragon/execute() + for(var/obj/effect/landmark/carpspawn/C in GLOB.landmarks_list) + spawn_locs += (C.loc) + if(!spawn_locs.len) + message_admins("No valid spawn locations found, aborting...") + return MAP_ERROR + . = ..() + +/datum/dynamic_ruleset/midround/from_ghosts/space_dragon/generate_ruleset_body(mob/applicant) + var/datum/mind/player_mind = new /datum/mind(applicant.key) + player_mind.active = TRUE + + var/mob/living/simple_animal/hostile/space_dragon/S = new (pick(spawn_locs)) + player_mind.transfer_to(S) + player_mind.assigned_role = "Space Dragon" + player_mind.special_role = "Space Dragon" + player_mind.add_antag_datum(/datum/antagonist/space_dragon) + + playsound(S, 'sound/magic/ethereal_exit.ogg', 50, TRUE, -1) + message_admins("[ADMIN_LOOKUPFLW(S)] has been made into a Space Dragon by the midround ruleset.") + log_game("DYNAMIC: [key_name(S)] was spawned as a Space Dragon by the midround ruleset.") + priority_announce("A large organic energy flux has been recorded in the vicinity of [station_name()], please stand-by.", "Lifesign Alert") + return S + ////////////////////////////////////////////// // // // VAMPIRE // diff --git a/code/modules/antagonists/space_dragon/space_dragon.dm b/code/modules/antagonists/space_dragon/space_dragon.dm index 5e75a740ace3..502067004df8 100644 --- a/code/modules/antagonists/space_dragon/space_dragon.dm +++ b/code/modules/antagonists/space_dragon/space_dragon.dm @@ -1,32 +1,51 @@ /datum/antagonist/space_dragon name = "Space Dragon" - show_in_antagpanel = FALSE + roundend_category = "space dragons" + antagpanel_category = "Space Dragon" + job_rank = ROLE_SPACE_DRAGON + show_in_antagpanel = TRUE show_name_in_check_antagonists = TRUE - show_to_ghosts = TRUE + var/list/datum/mind/carp = list() /datum/antagonist/space_dragon/greet() - to_chat(owner, "I am Space Dragon, ex-space carp, and defender of the secrets of constellation, Draco.") - to_chat(owner, "Fabulous secret powers were revealed to me the day I held aloft a wizard's staff of change and said 'By the power of Draco, I have the power!'") - to_chat(owner, "The wizard was turned into the short-lived Pastry Cat while I became Space Dragon, the most powerful beast in the universe.") - to_chat(owner, "Clicking a tile will shoot fire onto that tile.") - to_chat(owner, "Using Tail Sweep will let me get the better of those who come too close.") - to_chat(owner, "Attacking dead bodies will allow me to gib them to restore health.") - to_chat(owner, "From the wizard's writings, he had been studying this station and its hierarchy. From this, I know who leads the station, and will kill them so the station underlings see me as their new leader.") + to_chat(owner, "Endless time and space we have moved through. We do not remember from where we came, we do not know where we will go. All space belongs to us.\n\ + Space is an empty void, in which our kind is the apex predator, and there is little to rival our claim to this title.\n\ + But now, we find intruders spread out amongst our claim! They are willing to fight our teeth with magics unimaginable, in their strange metal dens flickering in the depths of space.\n\ + Today, we will remind them of our power.") + to_chat(owner, "You have five minutes to find a safe location to place down the first rift. If you take longer than five minutes to place a rift, you will be returned from whence you came.") owner.announce_objectives() SEND_SOUND(owner.current, sound('sound/magic/demon_attack1.ogg')) - + /datum/antagonist/space_dragon/proc/forge_objectives() - var/current_heads = SSjob.get_all_heads() - var/datum/objective/assassinate/killchosen = new - killchosen.owner = owner - var/datum/mind/selected = pick(current_heads) - killchosen.target = selected - killchosen.update_explanation_text() - objectives += killchosen - var/datum/objective/survive/survival = new - survival.owner = owner - objectives += survival - + var/datum/objective/summon_carp/summon = new() + summon.dragon = src + objectives += summon + /datum/antagonist/space_dragon/on_gain() forge_objectives() - . = ..() \ No newline at end of file + . = ..() + +/datum/objective/summon_carp + var/datum/antagonist/space_dragon/dragon + explanation_text = "Summon and protect the rifts to flood the station with carp." + +/datum/antagonist/space_dragon/roundend_report() + var/list/parts = list() + var/datum/objective/summon_carp/S = locate() in objectives + if(S.check_completion()) + parts += "The [name] has succeeded! Station space has been reclaimed by the space carp!" + parts += printplayer(owner) + var/objectives_complete = TRUE + if(objectives.len) + parts += printobjectives(objectives) + for(var/datum/objective/objective in objectives) + if(!objective.check_completion()) + objectives_complete = FALSE + break + if(objectives_complete) + parts += "The [name] was successful!" + else + parts += "The [name] has failed!" + parts += "The [name] was assisted by:" + parts += printplayerlist(carp) + return "
[parts.Join("
")]
" \ No newline at end of file diff --git a/code/modules/events/space_dragon.dm b/code/modules/events/space_dragon.dm index a6100cba7edc..6b43677d18c8 100644 --- a/code/modules/events/space_dragon.dm +++ b/code/modules/events/space_dragon.dm @@ -2,10 +2,9 @@ name = "Spawn Space Dragon" typepath = /datum/round_event/ghost_role/space_dragon max_occurrences = 1 - weight = 8 - earliest_start = 70 MINUTES + weight = 5 + earliest_start = 60 MINUTES min_players = 30 - dynamic_should_hijack = TRUE /datum/round_event/ghost_role/space_dragon minimum_required = 1 @@ -13,10 +12,10 @@ announceWhen = 10 /datum/round_event/ghost_role/space_dragon/announce(fake) - priority_announce("It appears a lifeform with magical traces is approaching [station_name()], please stand-by.", "Lifesign Alert") + priority_announce("A large organic energy flux has been recorded in the vicinity of [station_name()], please stand-by.", "Lifesign Alert") /datum/round_event/ghost_role/space_dragon/spawn_role() - var/list/candidates = get_candidates(ROLE_ALIEN, null, ROLE_ALIEN) + var/list/candidates = get_candidates(ROLE_SPACE_DRAGON, null, ROLE_SPACE_DRAGON) if(!candidates.len) return NOT_ENOUGH_PLAYERS @@ -32,7 +31,7 @@ message_admins("No valid spawn locations found, aborting...") return MAP_ERROR - var/mob/living/simple_animal/hostile/megafauna/dragon/space_dragon/S = new ((pick(spawn_locs))) + var/mob/living/simple_animal/hostile/space_dragon/S = new (pick(spawn_locs)) player_mind.transfer_to(S) player_mind.assigned_role = "Space Dragon" player_mind.special_role = "Space Dragon" @@ -42,4 +41,3 @@ log_game("[key_name(S)] was spawned as a Space Dragon by an event.") spawned_mobs += S return SUCCESSFUL_SPAWN - diff --git a/code/modules/mob/living/simple_animal/animal_defense.dm b/code/modules/mob/living/simple_animal/animal_defense.dm index 67d15553f50e..6e5563038b55 100644 --- a/code/modules/mob/living/simple_animal/animal_defense.dm +++ b/code/modules/mob/living/simple_animal/animal_defense.dm @@ -133,25 +133,38 @@ ..() if(QDELETED(src)) return - var/bomb_armor = getarmor(null, BOMB) switch (severity) if (EXPLODE_DEVASTATE) - if(prob(bomb_armor)) - adjustBruteLoss(500) - else - gib() - return + ex_act_devastate() if (EXPLODE_HEAVY) - var/bloss = 60 - if(prob(bomb_armor)) - bloss = bloss / 1.5 - adjustBruteLoss(bloss) + ex_act_heavy() if (EXPLODE_LIGHT) - var/bloss = 30 - if(prob(bomb_armor)) - bloss = bloss / 1.5 - adjustBruteLoss(bloss) + ex_act_light() + +/// Called when a devastating explosive acts on this mob +/mob/living/simple_animal/proc/ex_act_devastate() + var/bomb_armor = getarmor(null, BOMB) + if(prob(bomb_armor)) + adjustBruteLoss(500) + else + gib() + +/// Called when a heavy explosive acts on this mob +/mob/living/simple_animal/proc/ex_act_heavy() + var/bomb_armor = getarmor(null, BOMB) + var/bloss = 60 + if(prob(bomb_armor)) + bloss = bloss / 1.5 + adjustBruteLoss(bloss) + +/// Called when a light explosive acts on this mob +/mob/living/simple_animal/proc/ex_act_light() + var/bomb_armor = getarmor(null, BOMB) + var/bloss = 30 + if(prob(bomb_armor)) + bloss = bloss / 1.5 + adjustBruteLoss(bloss) /mob/living/simple_animal/blob_act(obj/structure/blob/B) adjustBruteLoss(20) diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm index b7d86dc059cc..b8e2d85d76b0 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm @@ -606,76 +606,3 @@ Difficulty: Medium lava_pools(10, 2) // less pools but longer delay before spawns player_cooldown = world.time + 200 // needs seperate cooldown or cant use fire attacks -/mob/living/simple_animal/hostile/megafauna/dragon/space_dragon - name = "space dragon" - maxHealth = 250 - health = 250 - faction = list("neutral") - desc = "A space carp turned dragon by vile magic. Has the same ferocity of a space carp, but also a much more enabling body." - icon = 'icons/mob/spacedragon.dmi' - icon_state = "spacedragon" - icon_living = "spacedragon" - icon_dead = "spacedragon_dead" - obj_damage = 80 - melee_damage_upper = 35 - melee_damage_lower = 35 - speed = 0 - mouse_opacity = MOUSE_OPACITY_ICON - loot = list() - crusher_loot = list() - butcher_results = list(/obj/item/stack/ore/diamond = 5, /obj/item/stack/sheet/sinew = 5, /obj/item/stack/sheet/bone = 30) - guaranteed_butcher_results = list(/obj/item/stack/sheet/animalhide/carpdragon = 10) - move_force = MOVE_FORCE_NORMAL - move_resist = MOVE_FORCE_NORMAL - pull_force = MOVE_FORCE_NORMAL - environment_smash = ENVIRONMENT_SMASH_WALLS - deathmessage = "screeches as its wings turn to dust and it collapses on the floor, life estinguished." - attack_action_types = list() - small_sprite_type = /datum/action/small_sprite/megafauna/spacedragon - music_component = null - -/mob/living/simple_animal/hostile/megafauna/dragon/space_dragon/Initialize() - var/obj/effect/proc_holder/spell/aoe_turf/repulse/spacedragon/repulse_action = new /obj/effect/proc_holder/spell/aoe_turf/repulse/spacedragon(src) - repulse_action.action.Grant(src) - mob_spell_list += repulse_action - . = ..() - -/mob/living/simple_animal/hostile/megafauna/dragon/space_dragon/proc/fire_stream(var/atom/at = target) - playsound(get_turf(src),'sound/magic/fireball.ogg', 200, 1) - SLEEP_CHECK_DEATH(0) - var/range = 20 - var/list/turfs = list() - turfs = line_target(0, range, at) - INVOKE_ASYNC(src, .proc/fire_line, turfs) - -/mob/living/simple_animal/hostile/megafauna/dragon/space_dragon/OpenFire() - if(swooping) - return - ranged_cooldown = world.time + ranged_cooldown_time - fire_stream() - -/obj/effect/proc_holder/spell/aoe_turf/repulse/spacedragon - name = "Tail Sweep" - desc = "Throw back attackers with a sweep of your tail." - sound = 'sound/magic/tail_swing.ogg' - charge_max = 200 - clothes_req = FALSE - antimagic_allowed = TRUE - range = 1 - cooldown_min = 200 - invocation_type = "none" - sparkle_path = /obj/effect/temp_visual/dir_setting/tailsweep - action_icon = 'icons/mob/actions/actions_xeno.dmi' - action_icon_state = "tailsweep" - action_background_icon_state = "bg_alien" - anti_magic_check = FALSE - -/obj/effect/proc_holder/spell/aoe_turf/repulse/spacedragon/cast(list/targets,mob/user = usr) - if(iscarbon(user)) - var/mob/living/carbon/C = user - playsound(C.loc,'sound/effects/hit_punch.ogg', 80, 1, 1) - C.spin(6,1) - ..(targets, user, 60) - -/mob/living/simple_animal/hostile/megafauna/dragon/space_dragon/AltClickOn(atom/movable/A) - return diff --git a/code/modules/mob/living/simple_animal/hostile/space_dragon.dm b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm new file mode 100644 index 000000000000..7f98cf25f52f --- /dev/null +++ b/code/modules/mob/living/simple_animal/hostile/space_dragon.dm @@ -0,0 +1,551 @@ +/** + * # Space Dragon + * + * A space-faring leviathan-esque monster which breathes fire and summons carp. Spawned during its respective midround antagonist event. + * + * A space-faring monstrosity who has the ability to breathe dangerous fire breath and uses its powerful wings to knock foes away. + * Normally spawned as an antagonist during the Space Dragon event, Space Dragon's main goal is to open three rifts from which to pull a great tide of carp onto the station. + * Space Dragon can summon only one rift at a time, and can do so anywhere a blob is allowed to spawn. In order to trigger his victory condition, Space Dragon must summon and defend three rifts while they charge. + * Space Dragon, when spawned, has five minutes to summon the first rift. Failing to do so will cause Space Dragon to return from whence he came. + * When the rift spawns, ghosts can interact with it to spawn in as space carp to help complete the mission. One carp is granted when the rift is first summoned, with an extra one every 40 seconds. + * Once the victory condition is met, the shuttle is called and all current rifts are allowed to spawn infinite sentient space carp. + * If a charging rift is destroyed, Space Dragon will be incredibly slowed, and the endlag on his gust attack is greatly increased on each use. + * Space Dragon has the following abilities to assist him with his objective: + * - Can shoot fire in straight line, dealing 30 burn damage and setting those suseptible on fire. + * - Can use his wings to temporarily stun and knock back any nearby mobs. This attack has no cooldown, but instead has endlag after the attack where Space Dragon cannot act. This endlag's time decreases over time, but is added to every time he uses the move. + * - Can swallow mob corpses to heal for half their max health. Any corpses swallowed are stored within him, and will be regurgitated on death. + * - Can tear through any type of wall. This takes 4 seconds for most walls, and 12 seconds for reinforced walls. + */ +/mob/living/simple_animal/hostile/space_dragon + name = "Space Dragon" + desc = "A vile leviathan-esque creature that flies in the most unnatural way. Slightly looks similar to a space carp." + maxHealth = 400 + health = 400 + health_doll_icon = "spacedragon" + a_intent = INTENT_HARM + speed = 0 + attacktext = "chomps" + attack_sound = 'sound/magic/demon_attack1.ogg' + deathsound = 'sound/magic/demon_dies.ogg' + icon = 'icons/mob/spacedragon.dmi' + icon_state = "spacedragon" + icon_living = "spacedragon" + icon_dead = "spacedragon_dead" + obj_damage = 50 + environment_smash = ENVIRONMENT_SMASH_NONE + flags_1 = PREVENT_CONTENTS_EXPLOSION_1 | HEAR_1 + mob_size = MOB_SIZE_LARGE + melee_damage_upper = 35 + melee_damage_lower = 35 + armour_penetration = 30 + pixel_x = -16 + turns_per_move = 5 + spacewalk = TRUE + ranged = TRUE + mouse_opacity = MOUSE_OPACITY_ICON + butcher_results = list(/obj/item/stack/ore/diamond = 5, /obj/item/stack/sheet/sinew = 5, /obj/item/stack/sheet/bone = 30) + guaranteed_butcher_results = list(/obj/item/stack/sheet/animalhide/carpdragon = 10) + deathmessage = "screeches as its wings turn to dust and it collapses on the floor, life estinguished." + atmos_requirements = list("min_oxy" = 0, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) + minbodytemp = 0 + maxbodytemp = 1500 + faction = list("carp") + pressure_resistance = 200 + /// Current time since the the last rift was activated. If set to -1, does not increment. + var/riftTimer = 0 + /// Maximum amount of time which can pass without a rift before Space Dragon despawns. + var/maxRiftTimer = 300 + /// How much endlag using Wing Gust should apply. Each use of wing gust increments this, and it decreases over time. + var/tiredness = 0 + /// A multiplier to how much each use of wing gust should add to the tiredness variable. Set to 5 if the current rift is destroyed. + var/tiredness_mult = 1 + /// Determines whether or not Space Dragon is in the middle of using wing guat. If set to true, prevents him from moving and doing certain actions. + var/using_special = FALSE + /// A list of all of the rifts created by Space Dragon. Used for setting them all to infinite carp spawn when Space Dragon wins, and removing them when Space Dragon dies. + var/list/obj/structure/carp_rift/rift_list = list() + /// How many rifts have been successfully charged + var/rifts_charged = 0 + /// Whether or not Space Dragon has completed their objective, and thus triggered the ending sequence. + var/objective_complete = FALSE + /// The togglable small sprite action + var/small_sprite_type = /datum/action/small_sprite/megafauna/spacedragon + /// The innate ability to use wing gust + var/datum/action/innate/space_dragon/gustAttack/gust + /// The innate ability to summon rifts + var/datum/action/innate/space_dragon/summonRift/rift + /// Minimum devastation damage dealt coefficient based on max health + var/devastation_damage_min_percentage = 0.4 + /// Maximum devastation damage dealt coefficient based on max health + var/devastation_damage_max_percentage = 0.75 + +/mob/living/simple_animal/hostile/space_dragon/Initialize(mapload) + . = ..() + if(small_sprite_type) + var/datum/action/small_sprite/small_action = new small_sprite_type() + small_action.Grant(src) + gust = new + gust.Grant(src) + rift = new + rift.Grant(src) + +/mob/living/simple_animal/hostile/space_dragon/Life(mapload) + . = ..() + tiredness = max(tiredness - 1, 0) + if(rifts_charged == 3 && !objective_complete) + victory() + if(riftTimer == -1) + return + riftTimer = min(riftTimer + 1, maxRiftTimer + 1) + if(riftTimer == (maxRiftTimer - 60)) + to_chat(src, "You have a minute left to summon the rift! Get to it!") + return + if(riftTimer == maxRiftTimer) + to_chat(src, "You've failed to summon the rift in a timely manner! You're being pulled back from whence you came!") + destroy_rifts() + QDEL_NULL(src) + +/mob/living/simple_animal/hostile/space_dragon/ex_act_devastate() + var/damage_coefficient = rand(devastation_damage_min_percentage, devastation_damage_max_percentage) + adjustBruteLoss(initial(maxHealth)*damage_coefficient) + +/mob/living/simple_animal/hostile/space_dragon/AttackingTarget() + if(using_special) + return + if(target == src) + to_chat(src, "You almost bite yourself, but then decide against it.") + return + if(istype(target, /turf/closed/wall)) + var/turf/closed/wall/thewall = target + to_chat(src, "You begin tearing through the wall...") + playsound(src, 'sound/machines/airlock_alien_prying.ogg', 100, TRUE) + var/timetotear = 40 + if(istype(target, /turf/closed/wall/r_wall)) + timetotear = 120 + if(do_after(src, timetotear, target = thewall)) + if(istype(thewall, /turf/open)) + return + thewall.dismantle_wall(1) + playsound(src, 'sound/effects/meteorimpact.ogg', 100, TRUE) + return + if(isliving(target)) //Swallows corpses like a snake to regain health. + var/mob/living/L = target + if(L.stat == DEAD) + to_chat(src, "You begin to swallow [L] whole...") + if(do_after(src, 30, target = L)) + if(eat(L)) + adjustHealth(-L.maxHealth * 0.5) + return + . = ..() + if(istype(target, /obj/mecha)) + var/obj/mecha/M = target + M.take_damage(50, BRUTE, "melee", 1) + +/mob/living/simple_animal/hostile/space_dragon/Move() + if(!using_special) + ..() + +/mob/living/simple_animal/hostile/space_dragon/OpenFire() + if(using_special) + return + ranged_cooldown = world.time + ranged_cooldown_time + fire_stream() + +/mob/living/simple_animal/hostile/space_dragon/death(gibbed) + empty_contents() + if(!objective_complete) + destroy_rifts() + ..() + +/mob/living/simple_animal/hostile/space_dragon/wabbajack_act(mob/living/new_mob) + empty_contents() + . = ..() + +/** + * Determines a line of turfs from sources's position to the target with length range. + * + * Determines a line of turfs from the source's position to the target with length range. + * The line will extend on past the target if the range is large enough, and not reach the target if range is small enough. + * Arguments: + * * offset - whether or not to aim slightly to the left or right of the target + * * range - how many turfs should we go out for + * * atom/at - The target + */ +/mob/living/simple_animal/hostile/space_dragon/proc/line_target(offset, range, atom/at = target) + if(!at) + return + var/angle = ATAN2(at.x - src.x, at.y - src.y) + offset + var/turf/T = get_turf(src) + for(var/i in 1 to range) + var/turf/check = locate(src.x + cos(angle) * i, src.y + sin(angle) * i, src.z) + if(!check) + break + T = check + return (getline(src, T) - get_turf(src)) + +/** + * Spawns fire at each position in a line from the source to the target. + * + * Spawns fire at each position in a line from the source to the target. + * Stops if it comes into contact with a solid wall, a window, or a door. + * Delays the spawning of each fire by 1.5 deciseconds. + * Arguments: + * * atom/at - The target + */ +/mob/living/simple_animal/hostile/space_dragon/proc/fire_stream(var/atom/at = target) + playsound(get_turf(src),'sound/magic/fireball.ogg', 200, TRUE) + var/range = 20 + var/list/turfs = list() + turfs = line_target(0, range, at) + var/delayFire = -1.5 + for(var/turf/T in turfs) + if(istype(T, /turf/closed)) + return + for(var/obj/structure/window/W in T.contents) + return + for(var/obj/machinery/door/D in T.contents) + if(D.density) + return + delayFire += 1.5 + addtimer(CALLBACK(src, .proc/dragon_fire_line, T), delayFire) + +/** + * What occurs on each tile to actually create the fire. + * + * Creates a fire on the given turf. + * It creates a hotspot on the given turf, damages any living mob with 30 burn damage, and damages mechs by 50. + * It can only hit any given target once. + * Arguments: + * * turf/T - The turf to trigger the effects on. + */ +mob/living/simple_animal/hostile/space_dragon/proc/dragon_fire_line(turf/T) + var/list/hit_list = list() + hit_list += src + new /obj/effect/hotspot(T) + T.hotspot_expose(700,50,1) + for(var/mob/living/L in T.contents) + if(L in hit_list) + continue + hit_list += L + L.adjustFireLoss(30) + to_chat(L, "You're hit by [src]'s fire breath!") + // deals damage to mechs + for(var/obj/mecha/M in T.contents) + if(M in hit_list) + continue + hit_list += M + M.take_damage(50, BRUTE, "melee", 1) + +/** + * Handles consuming and storing consumed things inside Space Dragon + * + * Plays a sound and then stores the consumed thing inside Space Dragon. + * Used in AttackingTarget(), paired with a heal should it succeed. + * Arguments: + * * atom/movable/A - The thing being consumed + */ +/mob/living/simple_animal/hostile/space_dragon/proc/eat(atom/movable/A) + if(A && A.loc != src) + playsound(src, 'sound/magic/demon_attack1.ogg', 100, TRUE) + visible_message("[src] swallows [A] whole!") + A.forceMove(src) + return TRUE + return FALSE + +/** + * Disperses the contents of the mob on the surrounding tiles. + * + * Randomly places the contents of the mob onto surrounding tiles. + * Has a 10% chance to place on the same tile as the mob. + */ +/mob/living/simple_animal/hostile/space_dragon/proc/empty_contents() + for(var/atom/movable/AM in src) + AM.forceMove(loc) + if(prob(90)) + step(AM, pick(GLOB.alldirs)) + +/** + * Resets Space Dragon's status after using wing gust. + * + * Resets Space Dragon's status after using wing gust. + * If it isn't dead by the time it calls this method, reset the sprite back to the normal living sprite. + * Also sets the using_special variable to FALSE, allowing Space Dragon to move and attack freely again. + */ +/mob/living/simple_animal/hostile/space_dragon/proc/reset_status() + if(stat != DEAD) + icon_state = "spacedragon" + using_special = FALSE + +/** + * Handles Space Dragon's temporary empowerment after boosting a rift. + * + * Empowers and depowers Space Dragon after a successful rift charge. + * Empowered, Space Dragon regains all his health and becomes temporarily faster for 30 seconds, along with being tinted red. + * Depowered simply resets him back to his default state. + */ +/mob/living/simple_animal/hostile/space_dragon/proc/rift_empower(is_empowered) + if(is_empowered) + fully_heal() + color = "#FF0000" + set_varspeed(-0.5) + addtimer(CALLBACK(src, .proc/rift_empower, FALSE), 300) + else + color = "#FFFFFF" + set_varspeed(0) + +/** + * Destroys all of Space Dragon's current rifts. + * + * QDeletes all the current rifts after removing their references to other objects. + * Currently, the only reference they have is to the Dragon which created them, so we clear that before deleting them. + * Currently used when Space Dragon dies. + */ +/mob/living/simple_animal/hostile/space_dragon/proc/destroy_rifts() + for(var/obj/structure/carp_rift/rift in rift_list) + rift.dragon = null + rift_list -= rift + if(!QDELETED(rift)) + QDEL_NULL(rift) + rifts_charged = 0 + +/** + * Handles wing gust from the windup all the way to the endlag at the end. + * + * Handles the wing gust attack from start to finish, based on the timer. + * When intially triggered, starts at 0. Until the timer reaches 10, increase Space Dragon's y position by 2 and call back to the function in 1.5 deciseconds. + * When the timer is at 10, trigger the attack. Change Space Dragon's sprite. reset his y position, and push all living creatures back in a 3 tile radius and stun them for 5 seconds. + * Stay in the ending state for how much our tiredness dictates and add to our tiredness. + * Arguments: + * * timer - The timer used for the windup. + */ +/mob/living/simple_animal/hostile/space_dragon/proc/useGust(timer) + if(timer != 10) + pixel_y = pixel_y + 2; + addtimer(CALLBACK(src, .proc/useGust, timer + 1), 1.5) + return + pixel_y = 0 + icon_state = "spacedragon_gust_2" + playsound(src, 'sound/effects/gravhit.ogg', 100, TRUE) + var/gust_locs = spiral_range_turfs(3, get_turf(src)) + var/list/hit_things = list() + for(var/turf/T in gust_locs) + for(var/mob/living/L in T.contents) + if(L == src) + continue + hit_things += L + visible_message("[L] is knocked back by the gust!") + to_chat(L, "You're knocked back by the gust!") + var/dir_to_target = get_dir(get_turf(src), get_turf(L)) + var/throwtarget = get_edge_target_turf(target, dir_to_target) + L.safe_throw_at(throwtarget, 10, 1, src) + L.Paralyze(50) + addtimer(CALLBACK(src, .proc/reset_status), 4 + ((tiredness * tiredness_mult) / 10)) + tiredness = tiredness + (30 * tiredness_mult) + +/** + * Sets up Space Dragon's victory for completing the objectives. + * + * Triggers when Space Dragon completes his objective. + * Calls the shuttle with a coefficient of 3, making it impossible to recall. + * Sets all of his rifts to allow for infinite sentient carp spawns + * Also plays appropiate sounds and CENTCOM messages. + */ +/mob/living/simple_animal/hostile/space_dragon/proc/victory() + objective_complete = TRUE + var/datum/antagonist/space_dragon/S = mind.has_antag_datum(/datum/antagonist/space_dragon) + if(S) + var/datum/objective/summon_carp/main_objective = locate() in S.objectives + if(main_objective) + main_objective.completed = TRUE + sound_to_playing_players('sound/machines/alarm.ogg') + sleep(100) + priority_announce("A large amount of lifeforms have been detected approaching [station_name()] at extreme speeds. Evacuation of the remamining crew will begin immediately.", "Central Command Spacial Corps") + for(var/obj/structure/carp_rift/rift in rift_list) + rift.carp_stored = 999999 + sleep(50) + SSshuttle.emergency.request(null, set_coefficient = 0.3) + +/datum/action/innate/space_dragon + background_icon_state = "bg_default" + icon_icon = 'icons/mob/actions/actions_space_dragon.dmi' + +/datum/action/innate/space_dragon/gustAttack + name = "Gust Attack" + button_icon_state = "gust_attack" + desc = "Use your wings to knock back foes with gusts of air, pushing them away and stunning them. Using this too often will leave you vulnerable for longer periods of time." + +/datum/action/innate/space_dragon/gustAttack/Activate() + var/mob/living/simple_animal/hostile/space_dragon/S = owner + if(S.using_special) + return + S.using_special = TRUE + S.icon_state = "spacedragon_gust" + S.useGust(0) + +/datum/action/innate/space_dragon/summonRift + name = "Summon Rift" + button_icon_state = "carp_rift" + desc = "Summon a rift to bring forth a horde of space carp." + +/datum/action/innate/space_dragon/summonRift/Activate() + var/mob/living/simple_animal/hostile/space_dragon/S = owner + if(S.using_special) + return + var/area/A = get_area(S) + if(!A.valid_territory) + to_chat(S, "You can't summon a rift here! Try summoning somewhere secure within the station!") + return + for(var/obj/structure/carp_rift/rift in S.rift_list) + var/area/RA = get_area(rift) + if(RA == A) + to_chat(S, "You've already summoned a rift in this area! You have to summon again somewhere else!") + return + to_chat(S, "You begin to open a rift...") + if(do_after(S, 100, target = S)) + for(var/obj/structure/carp_rift/c in S.loc.contents) + return + var/obj/structure/carp_rift/CR = new /obj/structure/carp_rift(S.loc) + playsound(S, 'sound/vehicles/rocketlaunch.ogg', 100, TRUE) + S.riftTimer = -1 + CR.dragon = S + S.rift_list += CR + to_chat(S, "The rift has been summoned. Prevent the crew from destroying it at all costs!") + notify_ghosts("The Space Dragon has opened a rift!", source = CR, action = NOTIFY_ORBIT, flashwindow = FALSE, header = "Carp Rift Opened") + qdel(src) + +/** + * # Carp Rift + * + * The portals Space Dragon summons to bring carp onto the station. + * + * The portals Space Dragon summons to bring carp onto the station. His main objective is to summon 3 of them and protect them from being destroyed. + * The portals can summon sentient space carp in limited amounts. The portal also changes color based on whether or not a carp spawn is available. + * Once it is fully charged, it becomes indestructible, and intermitently spawns non-sentient carp. It is still destroyed if Space Dragon dies. + */ +/obj/structure/carp_rift + name = "carp rift" + desc = "A rift akin to the ones space carp use to travel long distances." + armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 100, "bomb" = 50, "bio" = 100, "rad" = 100, "fire" = 100, "acid" = 100) + max_integrity = 300 + icon = 'icons/obj/carp_rift.dmi' + icon_state = "carp_rift" + light_color = LIGHT_COLOR_BLUE + light_range = 10 + anchored = TRUE + density = FALSE + layer = MASSIVE_OBJ_LAYER + /// The amount of time the rift has charged for. + var/time_charged = 0 + /// The maximum charge the rift can have. It actually goes to max_charge + 1, as to prevent constantly retriggering the effects on full charge. + var/max_charge = 240 + /// How many carp spawns it has available. + var/carp_stored = 0 + /// A reference to the Space Dragon that created it. + var/mob/living/simple_animal/hostile/space_dragon/dragon + +/obj/structure/carp_rift/Initialize(mapload) + . = ..() + carp_stored = 1 + time_charged = 1 + START_PROCESSING(SSobj, src) + +/obj/structure/carp_rift/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0) + playsound(src, 'sound/magic/lightningshock.ogg', 50, TRUE) + +/obj/structure/carp_rift/Destroy() + STOP_PROCESSING(SSobj, src) + if(time_charged != max_charge + 1) + to_chat(dragon, "The rift has been destroyed! You have failed, and find yourself brought down by the weight of your failure.") + dragon.set_varspeed(5) + dragon.tiredness_mult = 5 + dragon.destroy_rifts() + playsound(src, 'sound/vehicles/rocketlaunch.ogg', 100, TRUE) + return ..() + +/obj/structure/carp_rift/process() + time_charged = min(time_charged + 1, max_charge + 1) + update_check() + for(var/mob/living/simple_animal/hostile/hostilehere in loc) + if("carp" in hostilehere.faction) + hostilehere.adjustHealth(-10) + var/obj/effect/temp_visual/heal/H = new /obj/effect/temp_visual/heal(get_turf(hostilehere)) + H.color = "#0000FF" + if(time_charged < max_charge) + desc = "A rift akin to the ones space carp use to travel long distances. It seems to be [(time_charged / max_charge) * 100]% charged." + if(carp_stored == 0) + icon_state = "carp_rift" + light_color = LIGHT_COLOR_BLUE + else + icon_state = "carp_rift_carpspawn" + light_color = LIGHT_COLOR_PURPLE + else + var/spawncarp = rand(1,40) + if(spawncarp == 1) + new /mob/living/simple_animal/hostile/carp(loc) + +/obj/structure/carp_rift/attack_ghost(mob/user) + . = ..() + summon_carp(user) + +/** + * Does a series of checks based on the portal's status. + * + * Performs a number of checks based on the current charge of the portal, and triggers various effects accordingly. + * If the current charge is a multiple of 40, add an extra carp spawn. + * If we're halfway charged, announce to the crew our location in a CENTCOM announcement. + * If we're fully charged, tell the crew we are, change our color to yellow, become invulnerable, and give Space Dragon the ability to make another rift, if he hasn't summoned 3 total. + */ +/obj/structure/carp_rift/proc/update_check() + if(time_charged % 40 == 0 && time_charged != max_charge) + carp_stored++ + notify_ghosts("The carp rift can summon an additional carp!", source = src, action = NOTIFY_ORBIT, flashwindow = FALSE, header = "Carp Spawn Available") + if(time_charged == (max_charge - 120)) + var/area/A = get_area(src) + priority_announce("A rift is causing an unnaturally large energy flux in [A.map_name]. Stop it at all costs!", "Central Command Spacial Corps", 'sound/ai/spanomalies.ogg') + if(time_charged == max_charge) + var/area/A = get_area(src) + priority_announce("Spatial object has reached peak energy charge in [A.map_name], please stand-by.", "Central Command Spacial Corps") + obj_integrity = INFINITY + desc = "A rift akin to the ones space carp use to travel long distances. This one is fully charged, and is capable of bringing many carp to the station's location." + icon_state = "carp_rift_charged" + light_color = LIGHT_COLOR_YELLOW + armor = list("melee" = 100, "bullet" = 100, "laser" = 100, "energy" = 100, "bomb" = 100, "bio" = 100, "rad" = 100, "fire" = 100, "acid" = 100) + resistance_flags = INDESTRUCTIBLE + dragon.rifts_charged += 1 + if(dragon.rifts_charged != 3) + dragon.rift = new + dragon.rift.Grant(dragon) + dragon.riftTimer = 0 + dragon.rift_empower(TRUE) + +/** + * Used to create carp controlled by ghosts when the option is available. + * + * Creates a carp for the ghost to control if we have a carp spawn available. + * Gives them prompt to control a carp, and if our circumstances still allow if when they hit yes, spawn them in as a carp. + * Also add them to the list of carps in Space Dragon's antgonist datum, so they'll be displayed as having assisted him on round end. + * Arguments: + * * mob/user - The ghost which will take control of the carp. + */ +/obj/structure/carp_rift/proc/summon_carp(mob/user) + if(carp_stored == 0)//Not enough carp points + return FALSE + var/carp_ask = alert("Become a carp?", "Help bring forth the horde?", "Yes", "No") + if(carp_ask == "No" || !src || QDELETED(src) || QDELETED(user)) + return FALSE + if(carp_stored == 0) + to_chat(user, "The rift already summoned enough carp!") + return FALSE + var/mob/living/simple_animal/hostile/carp/newcarp = new /mob/living/simple_animal/hostile/carp(loc) + newcarp.key = user.key + var/datum/antagonist/space_dragon/S = dragon.mind.has_antag_datum(/datum/antagonist/space_dragon) + if(S) + S.carp += newcarp.mind + to_chat(newcarp, "You have arrived in order to assist the space dragon with securing the rift. Do not jeopardize the mission, and protect the rift at all costs!") + carp_stored -= 1 + return TRUE + +// Carp rifts always take heavy explosion damage. Discourages the use of maxcaps +// and favours more weaker explosives to destroy the portal +// as they have the same effect on the portal. +/obj/structure/carp_rift/ex_act(severity, target) + return ..(min(EXPLODE_HEAVY, severity)) \ No newline at end of file diff --git a/icons/mob/actions/actions_space_dragon.dmi b/icons/mob/actions/actions_space_dragon.dmi new file mode 100644 index 000000000000..a4e33eef1eb2 Binary files /dev/null and b/icons/mob/actions/actions_space_dragon.dmi differ diff --git a/icons/mob/spacedragon.dmi b/icons/mob/spacedragon.dmi index 4549ea9ea283..a1f3d4d782bc 100644 Binary files a/icons/mob/spacedragon.dmi and b/icons/mob/spacedragon.dmi differ diff --git a/icons/obj/carp_rift.dmi b/icons/obj/carp_rift.dmi new file mode 100644 index 000000000000..9a07b3b16f86 Binary files /dev/null and b/icons/obj/carp_rift.dmi differ diff --git a/sound/ai/spanomalies.ogg b/sound/ai/spanomalies.ogg new file mode 100644 index 000000000000..7680726f1533 Binary files /dev/null and b/sound/ai/spanomalies.ogg differ diff --git a/yogstation.dme b/yogstation.dme index 5bea18dda1e9..0d9ee0a6659f 100644 --- a/yogstation.dme +++ b/yogstation.dme @@ -2548,6 +2548,7 @@ #include "code\modules\mob\living\simple_animal\hostile\russian.dm" #include "code\modules\mob\living\simple_animal\hostile\skeleton.dm" #include "code\modules\mob\living\simple_animal\hostile\smspider.dm" +#include "code\modules\mob\living\simple_animal\hostile\space_dragon.dm" #include "code\modules\mob\living\simple_animal\hostile\statue.dm" #include "code\modules\mob\living\simple_animal\hostile\stickman.dm" #include "code\modules\mob\living\simple_animal\hostile\syndicate.dm"